Add Alternative Row Color to SSRS Report

In this article, we will show you how to add Alternative Row Color to SSRS Report. It is one of the Frequently asked questions by the users. So, here, we will show you the step by step approach to add Alternative Row Colors to SSRS Report using an Expression with an example.

We are going to use the below-shown DataSet to explain the same. Please refer to Embedded Data Source and Dataset articles to understand the steps involved in creating Embedded Data Source and Dataset that we used for this SSRS report.

Add Alternative Row Color to SSRS Report 1

And the Custom SQL query that we used in the above Dataset is:

-- Display Alternative Row Colors in SSRS Report
SELECT [FirstName] +  ' ' + [LastName] AS FullName
      ,[Education]
      ,[Occupation]
      ,[YearlyIncome]
      ,[Sales]
      ,[HireDate]
  FROM [Employee]

Data written by the above query is:

Add Alternative Row Color to SSRS Report 0

How to add Alternative Row Color to SSRS Report

We are going to use the previously designed report, as we have shown below. Please refer to the SSRS Table ReportFormat-Table Report article, to understand the steps involved in creating Table Report & format. Next, visit Add headers and Footer to SSRS Report article for adding Page headers and footers.

Add Alternative Row Color to SSRS Report 2

Let me show you the Report Preview.

Add Alternative Row Color to SSRS Report 3

When you select the details row, you have an option called Background color in the properties pane. You can use all the predefined colors if you want to make the standard color for all the rows returned by the report.

Add Alternative Row Color to SSRS Report

Here our task is to add alternate row color to SSRS Report. It means we have to use some condition to check for alternating rows.

To do so, Please click on the Expression hyperlink under the Background Color property.

Add Alternative Row Color to SSRS Report 4

Once you click on the Expression hyperlink, a new window called the Expression will open. Use this expression window to check for alternate rows.

Add Alternative Row Color to SSRS Report 5

Within the Expression, we are going to use the IIF condition to check whether the row number is even or not. If it is even, Pale Turquoise, otherwise Plum.

=IIF(RowNumber(Nothing) MOD 2 = 0, "PaleTurquoise", "Plum")
Add Alternative Row Color to SSRS Report 6

Once completed, Click OK to close the window

Add Alternative Row Color to SSRS Report 7

As you can see that our report preview is displaying the specified colors as the alternate row color in SSRS Report

Add Alternative Row Color to SSRS Report 8