avdeveloper
avdeveloper

Reputation: 549

How to alternate rows after each 2 row background color in SSRS

I am trying to alternate every 2 rows background color from white to blue as per below design in SSRS:

enter image description here

I have tried the below expression but it does not give the expected result:

=IIf((RowNumber(NOTHING) Mod 4) < 3 , "Blue", "Transparent")

Has anyone ever done anything similar and is there a way to achieve this?

Upvotes: 0

Views: 216

Answers (1)

Alan Schofield
Alan Schofield

Reputation: 21738

I've just tested the following and it works on a simple table. If it does not work for you, please share your table/matrix design including any row or column groups.

=IIF(((RowNumber(Nothing)-1) Mod 4) < 2 , "Blue", Nothing)

This simply offsets the mod calculation by 1 as the first row is 1 so we get a sequence of 0,1,2,3,0,1,2,3....

I find that adding a new column with the mod expression helps debug things like this. SO I would add a new column with =(RowNumber(Nothing)-1) Mod 4 as the expression and see what it returns.

Upvotes: 2

Related Questions