Benzz
Benzz

Reputation: 119

SSRS Alternate Row Colour based on a value

I understand that the following will produce an alternate row colour on a row in a table: =IIF(ROWNUMBER(NOTHING) MOD 2, "LIGHTBLUE", "SILVER")

What I am looking for is to change colour based on set values, for example I have the following result:

RecId        Seq
28292952799   0
28292952799   1
28292952799   2
28292970802   0
28292970802   1
28292980070   0
28292980070   1
28292980070   2

Based on the above, I would want it to colour based on each incrementation of the RecId Value.

My reason behind this is they do not want it grouped and it makes it more readable per ID.

Any help or advice is appreciated!

Upvotes: 1

Views: 1447

Answers (1)

R_Avery_17
R_Avery_17

Reputation: 305

=IIF(RUNNINGVALUE(Fields!RecId.Value, COUNTDISTINCT,"MainDataSet") MOD 2 = 0, 
   "LightBlue", 
    "Silver")

This worked for me when i wanted to do something similar.

The expression is giving every distinct name a row number and using the modulo operation. If the row number divided by 2 has a remainder (odd numbers) then the color will be Silver

Upvotes: 2

Related Questions