SSRS: Colour Striping Rows

Tabular reports are so much easier to read when you fill in alternating rows with different colours. This becomes especially important when you have particularly wide tables. This technique is also called zebra stripes or candy stripes. Cute.

In Visual Studio, select the row of your tablix data region (table) and enter the following expression for the 'BackgroundColor' property (under 'Fill'):

=IIF(RowNumber(Nothing) Mod 2, "Black", "White")

Replace the colours there with whichever colours you want to use. In this very unlikely example I have it set to stripe the rows in black and white. You can enter simple text colour names like I did, or you can enter hex codes to get the exact colour you're wanting.

One thing I really like doing in my reports is to set up my own colour palette using report variables. I will set variable named like 'AccentColour1' and set the value to whatever hex code I want (e.g., #87CEEB). Then when I am doing striping like this and want the colours to be consistent with the rest of my report, I will enter the variables into the expressions instead of hard-coding the colour names or values. Here's what that would look like:

=IIF(RowNumber(Nothing) Mod 2, Variables!AccentColour1.Value, Variables!AccentColour2.Value)

I'm a fan of this approach because you can easily switch up colours across your entire report if needed instead of having to go in and edit them for each object individually.

If you're looking for my post on how to do this in Excel, check out that post here.
Read More