Count the Number of Groups in a Report
This document describes how to count the number of groups in a report.
A report can display the total number of groups after binding your report to data and providing content to the report's detail band.
First, group the report's data. Switch to the Group and Sort panel and create a new group. Enable the Show Header option to display the group header in the report.
Switch to the Field List and drop the group field onto the created group header.
Right-click the report's surface and add a report footer to the report.
Drop a label onto the report footer and click its smart tag. In the invoked Label Tasks window, click the Summary property's ellipsis button.
In the Summary Editor window:
- Set the Summary running property to the Report value.
- Set the Summary function property to DCount.
- Set the Argument expression property to [CategoryName].
Back in the Label Tasks window, you can use the FormatString property to format the summary's value:
You can see the group count in the report footer when switching to Print Preview: