Oleg Oleg - 4 months ago 21
SQL Question

how to change row Background color in ssrs when all values in a group

I have Column Type and Group MonthNum. How can I change a Background color or each row?
Trying to use SWITCH function but for some reason it doesnt do enything:

=SWITCH
(
Fields!Type.Value = "Submitted - New Business" , "LightGrey",
Fields!Type.Value = "Submitted - Renewals" , "LightGrey",
Fields!Type.Value = "Submitted - ALL" , "Silver",
Fields!Type.Value = "Quoted - New Business" , "LightBlue",
Fields!Type.Value = "Quoted - Renewals" , "LightBlue",
Fields!Type.Value = "Quoted - ALL" , "LightSteelBlue",
Fields!Type.Value = "Bound - New Business" , "LightGrey",
Fields!Type.Value = "Bound - Renewals" , "LightGrey",
Fields!Type.Value = "Bound - ALL" , "Silver",
Fields!Type.Value = "Declined - New Business" , "LightBlue",
Fields!Type.Value = "Declined - Renewals" , "LightBlue",
Fields!Type.Value = "Declined - ALL" , "LightSteelBlue",

"Transparent"
)


I need something like that:
enter image description here

My group:
enter image description here

Answer

Try this:

=SWITCH 
    (
    Fields!Type.Value = "Submitted - New Business" , "LightGrey",
    Fields!Type.Value = "Submitted - Renewals" , "LightGrey",
    Fields!Type.Value = "Submitted - ALL" , "Silver",
    Fields!Type.Value = "Quoted - New Business" , "LightBlue",
    Fields!Type.Value = "Quoted - Renewals" , "LightBlue",
    Fields!Type.Value = "Quoted - ALL" , "LightSteelBlue",
    Fields!Type.Value = "Bound - New Business" , "LightGrey",
    Fields!Type.Value = "Bound - Renewals" , "LightGrey",
    Fields!Type.Value = "Bound - ALL" , "Silver",
    Fields!Type.Value = "Declined - New Business" , "LightBlue",
    Fields!Type.Value = "Declined - Renewals" , "LightBlue",
    Fields!Type.Value = "Declined - ALL" , "LightSteelBlue",
    true, "Transparent"
    )

Or change "transparent" to "white", which works better with some output formats. Also, Make sure the field values don't have weird spaces or characters, like "Quoted - ALL " (space after "ALL"). That will mess up the equivalency test.

Comments