Alternating Row Colors in SSRS
Alternating Row Colors in SSRS
Here is a simple report with alternating row colors; in this case, PaleGoldenRod and LightSteelBlue:
In order to create alternating colors, we start by going to the Design tab and selecting the detail row in the tablix data region.
Next, find the BackgroundColor property in the Properties Window (if you do not see the Properties Window, press F4). Click the BackgroundColor property’s dropdown button and select Expression…
Type the following expression into the Expression Builder window (ignore the red squiggly line; it complains but it works just fine). Use whatever colors you prefer.
Here’s how that expression works: RowNumber() is a function that returns the current row number when the report runs. Inside the parenthesis, we specify the scope, or when we want the row number to reset to 1. By using “Nothing,” we tell it that the scope is the entire report, so that row numbers start with 1 on the first row and just keep counting up through the entire report (if we had wanted to reset row numbers at the start of every group, for example, we would have put the name of the group in the parenthesis, delimited in double quotes). The Mod operator stands for “modulo,” which returns the remainder of a division. In this case, the expression returns the remainder of a division in which the row number is divided by two. If the remainder is 1, then the row number is odd, and if it is two, the row number is even. In VB.Net, which is the language used in the Expression dialog, 0 is False and any other number is equivalent to True. So, when the row number is odd, the remainder is 1, or True, which causes the PaleGoldenRod color to be returned. When the row number is even, the remainder is 0, or False, which causes the LightSteelBlue color to be returned.
Once you’ve entered the expression, click OK, preview your report, and enjoy the alternating colors!
You May Also Like
In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management
This is part 1 of our 5-part Office 365 free training course. In this Office 365 training video, instructor Spike Xavier introduces some of the most popular services found in Microsoft Office 365 including the Admin Portal and Admin Center. For instructor-led Office 365 training classes, see our course schedule: Spike Xavier SharePoint Instructor – … Continue reading An Overview of Office 365 – Administration Portal and Admin Center
In this Office 365 training video, instructor Spike Xavier demonstrates how to create users and manage passwords in Office 365. For instructor-led Office 365 training classes, see our course schedulle: Spike Xavier SharePoint Instructor – Interface Technical Training Phoenix, AZ 20347: Enabling and Managing Office 365