0

i currently have the row background colour set with expression that is;

=IIF(ROWNUMBER(NOTHING) MOD 2,"White","Silver")

However on some rows it seems that colour is not alternating and staying the same like the image below. Does any one know why this may be happening

image of alternating rows

KCodeR
  • 121
  • 5
  • 19

1 Answers1

1

The expression itself is fine, it's the scope that's the problem. The ROWNUMBER function gives different results based on which groups it's in within your matrix. You are currently using Nothing as the argument which tells it to use the default scope. You will need to look into overriding that with the correct group name so that the row numbers are calculated relative to the scope you actually want.

StevenWhite
  • 5,907
  • 3
  • 21
  • 46
  • I used the following function > =IIF(ROWNUMBER(Details1) MOD 2,"White","Silver") and got a error when running report in preview. The BackgroundColor expression for the text box StartDate1' has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset. – KCodeR May 18 '17 at 17:26
  • @KCodeR - is **Details1** in "Quotes"? i.e. `ROWNUMBER("Details1")` – Hannover Fist May 18 '17 at 17:37
  • Thanks that has now given no errors when previewing the report however all rows are now a white background and not alternating – KCodeR May 18 '17 at 17:41
  • Any idea ? @HannoverFist – KCodeR May 19 '17 at 11:10
  • Steven had said to use the group name of the chart grouping. Is the Details your Dataset name? I gave up on relying on RowNumber because of issues and use the Alternate Row Color VB function - http://stackoverflow.com/questions/35894822/alternating-row-color-expression-in-ssrs-matrix-not-working-correctly – Hannover Fist May 19 '17 at 18:19