Skip to main content

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.

    group-data-category-name

  • Switch to the Field List and drop the group field onto the created group header.

    group-data-category-name-drop-onto-header

  • Right-click the report’s surface and add a report footer to the report.

    add-report-footer-context-menu.png

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

    label-expression-summary-running

  • 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].

    label-expression-smart-tag-2

  • Back in the Label Tasks window, you can use the FormatString property to format the summary’s value:

    summary-expression-sum-dcount-format

You can see the group count in the report footer when switching to Print Preview:

counting-groups-preview-result