I have some issues getting alternate row colors.
I've tried different expressions and this is as close as I've gotten to getting it done:
=IIF(RunningValue(Fields!agent_name.Value,CountDistinct, Nothing) MOD 2 = 1, "Gainsboro", "White")
Where all other of my reports are getting correct alt row shading, I'm having trouble with this specific report that has a Row group and a Column group.. Spent about 2 days and still no luck :(
When I make my rows with the above expression, it is displayed like this:
My Row group obviously is the name,
Column group is the Month/year.
Any suggestions / assistance would be greatly appreciated
The problem is that there are NULLs in the data where the matrix is creating cells where there is no data. Since there's no Agent_Name associated for those cells, they default to the white.
I gave up on using Runnning Values and Row Numbers in SSRS and usually use the Alternating Row Color function.
You add some VB Code to the report (Report properties > Code):
Then use an expression to populate the colors:
The first two arguments are the colors to alternate between, the third argument is the control that tells it to switch colors, and the fourth argument is for the group to be used for nested grouping.
The first column of the row has the control with the first 1.
Use this in your first column - where you have your Agent Name.
How to create Alternative Row Background colors in SSRS for values in a group
Necromancing.
The accepted answer didn't work for me, as the Toggle is very irregular within the column-grouping.
However, the below code worked.
You need to set background-color in the first cell as
And in all subsequent cells as
Setting it as group variable will not work, because the sorting is applied after the grouping (which means the rows are re-arranged after the values have been generated).
Or you can do it even simpler:
and then in the first row's background-color:
and all subsequent rows' background-color:
That has the advantage that you can switch the colors in ONE place (DRY).