How to Apply Alternating Row Colors in an SSRS Tablix

Barbra WekeBarbra Weke
4 min read

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.

Designer Page for Simple Table

Let’s see how to apply alternating row colors to the simple table design:

  1. On the designer page, select the entire row group.

    Selecting Entire Row in Table

  2. 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.

    Properties Panel

  3. Set the following expression in the expression builder and click OK.
    =IIF(RowNumber(Nothing) MOD 2, "#F4F4F4", "#FFFFFF")

    Expression Builder Panel

    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.

  4. Click the Preview button at the top-right corner to see the alternating row colors applied to the table.

    Final Report for Table Design

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.

Grouping Report Designers

Let’s apply alternating row colors for groupings:

  1. 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.

    Properties Panel for Grouping

  2. Set the following expression in the expression builder and click OK.
    =IIF(RunningValue(Fields!ProdCat.Value, CountDistinct, Nothing) MOD 2, "#F4F4F4", "#FFFFFF")

    Expression Builder Dialog for Product Category

    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.

  3. 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.

    Sub Category Designer Page for Grouping

  4. Set the following expression in the expression builder and click OK.
    =IIF(RunningValue(Fields!SubCat.Value, CountDistinct, Nothing) MOD 2, "#F4F4F4", "#FFFFFF")

    Expression Builder for Sub Category

  5. 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.

    Designer Page for OrderQtr and Sales

  6. Set the following expression in the expression builder and click OK.
    =IIF(RowNumber(Nothing) MOD 2, "#F4F4F4", "#FFFFFF")

    Expression Dialog for Alternate Row

  7. Finally, select the other data cells and apply a background ground color to improve the report presentation at a detailed level.

    Background color for Other Cells

  8. Then, click the Preview button at the top-right corner to see that alternate row colors are applied to the grouping.

    Final Report for 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.

Report Designer Page for Matrix

Let’s apply alternating row colors for a matrix:

  1. 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.

    Product Category Selection in Matrix

  2. Set the following expression in the expression builder and click OK.
    =IIF(RunningValue(Fields!ProdCat.Value, CountDistinct, Nothing) MOD 2, "#F4F4F4", "#FFFFFF")

    Product Category Expression Builder for Matrix

  3. 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.

    Other Cell Selection in Matrix

  4. Set the following expression in the expression builder and click OK.
    =IIF(RunningValue(Fields!SubCat.Value, CountDistinct, Nothing) MOD 2, "#F4F4F4", "#FFFFFF")

    Expression Builder in Matrix

  5. Then, click the Preview button at the top-right corner to see alternating row colors applied to the matrix.

    Final Image for 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.

0
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.