How to Apply Alternating Row Colors in an SSRS Tablix
Many organizations use a tablix to organize and analyze large data sets. When the data amount is large, we might need to improve the visualization and readability of a report by applying alternating row colors. In this article, we’ll walk you through the steps to configure alternating row colors for table, groups, and matrix reports using the Bold Reports Designer.
Alternate Row Colors in a Table
Create a table report by referring to this documentation, or download the report from GitHub. Open the downloaded report in the Bold Reports Designer.
Let’s see how to apply alternating row colors to the simple table design:
On the designer page, select the entire row group.
Under the Appearance category, click the square icon at the right corner of the Background Color property and click the Expression menu to open the expression builder.
Set the following expression in the expression builder and click OK.
=IIF(RowNumber(Nothing) MOD 2, "#F4F4F4", "#FFFFFF")
RowNumber – Returns a running count of the number of rows for the specified scope in a paginated report.
Nothing – Specifies the context in which to evaluate the number of rows.Click the Preview button at the top-right corner to see the alternating row colors applied to the table.
Alternate Row Colors in Groupings
Create a table report by referring to this documentation or download the report from GitHub. Open the downloaded report in the Bold Reports Designer.
Let’s apply alternating row colors for groupings:
Select the first-row group cell (ProdCat) and click the square icon at the right corner of the Background Color property under the Appearance category. Then, click the Expression menu to open the expression builder.
Set the following expression in the expression builder and click OK.
=IIF(RunningValue(Fields!ProdCat.Value, CountDistinct, Nothing) MOD 2, "#F4F4F4", "#FFFFFF")
RunningValue – Returns a running aggregate of all non-null numeric values specified by the expression, evaluated for the given scope.
CountDistinct – Returns a count of all distinct non-null values specified by the expression in a paginated report, evaluated in the context of the given scope.Select the second-row group cell (SubCat) and click the square icon at the right corner of the Background Color property under the Appearance category. Then, click the Expression menu to open the expression builder.
Set the following expression in the expression builder and click OK.
=IIF(RunningValue(Fields!SubCat.Value, CountDistinct, Nothing) MOD 2, "#F4F4F4", "#FFFFFF")
Then, select the ‘OrderQtr’ and ‘Sales’ row-group cells and click the square icon at the right corner of the Background Color property under the Appearance category. Then, click the Expression menu to open the expression builder.
Set the following expression in the expression builder and click OK.
=IIF(RowNumber(Nothing) MOD 2, "#F4F4F4", "#FFFFFF")
Finally, select the other data cells and apply a background ground color to improve the report presentation at a detailed level.
Then, click the Preview button at the top-right corner to see that alternate row colors are applied to the grouping.
Alternate Row Colors in a Matrix
Create a matrix report by referring to this documentation or download the report from GitHub. Open the downloaded report in Bold Reports Designer.
Let’s apply alternating row colors for a matrix:
Select the first-row group cell (ProdCat) and click the square icon at the right corner of the Background Color property under the Appearance category. Then click the Expression menu to open the expression builder.
Set the following expression in the expression builder and click OK.
=IIF(RunningValue(Fields!ProdCat.Value, CountDistinct, Nothing) MOD 2, "#F4F4F4", "#FFFFFF")
Then, select the ‘SubCat’ and ‘Sum(Sales)’ row group cells and click the square icon at the right corner of the Background Color property under the Appearance category. Then click the Expression menu to open the expression builder.
Set the following expression in the expression builder and click OK.
=IIF(RunningValue(Fields!SubCat.Value, CountDistinct, Nothing) MOD 2, "#F4F4F4", "#FFFFFF")
Then, click the Preview button at the top-right corner to see alternating row colors applied to the matrix.
Conclusion
I hope this blog provided a clear idea about how to apply alternating row colors in Tablix. To explore further, go through our sample reports and Bold Reports documentation.
If you have any questions, please post them in the comments section. You can also contact us through our contact page, or, if you already have an account, you can log in to submit your support question.
Bold Reports now comes with a 15-day free trial with no credit card information required. We welcome you to start a free trial and experience Bold Reports for yourself. Give it a try and let us know what you think!
Stay tuned to our official Twitter, Facebook, and LinkedIn pages for announcements about upcoming releases.
Subscribe to my newsletter
Read articles from Barbra Weke directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Barbra Weke
Barbra Weke
Barbra is a content producer at Syncfusion who is committed to producing captivating content for Bold Reports products. She works closely with subject matter experts to craft instructional material and collaborates with graphics designers to create engaging content that resonates with the audience.