Back to Devexpress

Sort Groups by the Result of a Summary Function

xtrareports-7789-feature-guide-to-devexpress-reports-shape-report-data-group-and-sort-sort-groups-by-a-summary-functions-result.md

latest1.8 KB
Original Source

Sort Groups by the Result of a Summary Function

  • Feb 18, 2026
  • 2 minutes to read

This topic shows you how to sort groups by the result of a summary function. In the report created in this tutorial, the groups are sorted by the number of records they contain (the summary function is Count).

In this example, the report is bound to the Products table of the sample Northwind database.

Do the following to group the report and sort the groups by number of items:

  1. Invoke the Group and Sort Panel and group the report by the CategoryID data field:

  2. Click the Group Header band’s smart tag, and click the ellipsis button next to the GroupHeaderBand.SortingSummary property:

  3. In the invoked Group Sorting Summary Editor , check the Enabled option, set the Field option to ProductName , and set the Summary function to Count.

  4. Add data-bound labels to the bands, as shown in the following image. Specify the Count summary function to display the product count. For more information on summaries, review the following help topic: Summaries Overview.

  5. Specify that the detail band occupies three columns to save space in the report:

  6. Preview the report to see the result.