IAltering color in Report Tablix is common task for reporting developer. It helpes user to be better oriented in output data.
I will demonstrate this functionality on report created in one of previous post. I chose report with grouping. I will implement altering colour per row on each of Tablix group region. Lets start with EnglishCountryRegionName group region. Select Textboxes, highlighted on picture bellow.
Go to Report Properties pane to Fill section. There is set static color as you see on the picture bellow.
Replace the static colour with following expression.
=IIF(RUNNINGValue(Fields!EnglishCountryRegionName.Value,CountDistinct,"DataSet1") MOD 2 = 1, "#9eb6e4", "White")
I try to explain the expression in more detail. We use function RunningValue which takes tree arguments. The first one is the field value, we use EnglishCountryRegionName value returnign name of each country region. The second one parameter is aggregate function. In our case it is count distinct, which will be calculated for each EnglichCountryRegionName field. The last one parameter sets scope for which the function is used. In our case we can put Nothing or “DataSet1” as the scope.
In design mode, there will not be visible any colour, Expression will be rendered when the report is running.
When running report, we can see that background colour changes for each EnglishCountryRegionName value.
Repeat the same for other groups to achieve similar report design on picture bellow.