Alternate row background colour in Reporting Services
- Joel Lipman
- SQL Server Reporting Services
- Hits: 12657
This is just a note for me as it took a while to find on the net and even then it was confusing as to why it works but it does. Not sure whether you call this an MDX Query or part of a Transact-SQL mashup. You need to go to "Fill" (of each text box in the row - unless there's a faster way) and instead of color, click on the expression button (fx) and use the following:
=IIF(RowNumber(Nothing) Mod 2, "#ffffff", "#eeeeee") or =IIF(RowNumber(Nothing) Mod 2, "WhiteSmoke", "Garamond")
- =IIF(RowNumber(Nothing) Mod 2, "#ffffff", "#eeeeee")
- or
- =IIF(RowNumber(Nothing) Mod 2, "WhiteSmoke", "Garamond")
This is telling the report to be white (=#ffffff) in row 1 (odd row numbers) and a very light grey (=#eeeeee) in row 2 (even row numbers). The first row being of all rows in the dataset and not for a particular drill-down item. It will alternate between the two for the rest of the report. [The second example is what I use most frequently].