SQL Server Reporting Services (SSRS) – Alternate row colors with no group, 1 group, or multiple groups

In order to do alternate row coloring for an SSRS report that has grouping, you need an expression for your BackgroundColor property different than the typical:

=iif(rownumber (nothing) mod 2 = 0, "LightGrey", "White")

You can use the following expression now matter how many groupings you have:

=IIF(RunningValue(Fields!somefield.Value,CountDistinct,NOTHING) MOD 2 = 0,"LightGrey", "White")

For multiple grouping, append the fields separated by an &

=IIF(RunningValue(Fields!somefield.Value & Fields!somefield2.Value, CountDistinct, NOTHING) MOD 2 = 0, "White", "LightGrey")

Leave a Reply