Articles in this section

How to Add a Serial Number to a Matrix in Bold Reports

Published:
Updated:

To add a sequential serial number to each group in a matrix in the Bold Reports Report Designer, select the text box in the matrix’s row-group cell and enter =RunningValue(Fields!ProductID.Value, CountDistinct, "DataSet1"), using the field your row group is grouped on. RunningValue with CountDistinct advances the number by one for each new distinct value, giving one number per group.

When to use this

Use this when you need a sequential row number or group counter inside a matrix (tablix). For example, to label each distinct row group 1, 2, 3. RDL (Report Definition Language) reports support this through the RunningValue aggregate function, which returns a running aggregate of a value within a scope you specify.

The number is correct as one per group only when the field you pass to CountDistinct is the field the row group is grouped on. That field has exactly one distinct value per group, so the counter advances by exactly one each time a new group starts. If you pass a different field, the number follows that field’s distinct values, not the groups.

Steps

  1. Open the report in the Bold Reports Report Designer.

  2. Locate the matrix cell where you want the serial number to appear, and click it to select it.

  3. Open the Expression editor for that cell, from the cell’s properties or its right-click context menu.

  4. Enter the following expression, then click OK.

    =RunningValue(Fields!ProductID.Value, CountDistinct, "DataSet1")
    

    RunningValue returns a running aggregate within the scope you name. CountDistinct counts distinct ProductID values, which produces a sequential number for each new group. Replace ProductID and DataSet1 with your own field and dataset names.

    Running_value.png

  5. Save the report, then click Preview to see the serial number column.

    Output.png

Result

When the field in CountDistinct is the row group’s grouping field, the matrix shows a serial number that increments 1, 2, 3 for each group. Repeated values inside a single group do not change the number, because CountDistinct removes duplicates before counting. The value is recalculated each time the report runs.

Related articles

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied