Skip to main content

Sort and Group Report Data

  • 3 minutes to read

This tutorial describes how to sort and group data in a report created in previous tutorials as well as what options affect grouping behavior.

report-server-grouping-data-result

Sort Report Data

Select the detail report’s Detail band and expand the Actions category in the Properties panel. In the Sort Fields section, click the plus button to create a new sorting field.

report-server-detail-band-add-sort-field

In the Sort By drop-down list, choose a data member across which the detail report should be sorted.

report-server-sort-field-sort-by-property

Click the corresponding arrow button to manage the sorting order for this criterion. The report-server-sort-order-ascending and report-server-sort-order-descending icons indicate the ascending and descending sorting order, respectively. Click this button until it is marked with the report-server-sort-order-no-sorting icon to disable sorting.

You can define the priority for multiple sorting criteria using the report-server-move-up-button and report-server-move-down-button buttons.

Group Report Data

To split data into groups based on identical values in the Discount data field, do the following:

  1. Switch to the Properties panel and add a Group Header band to the detail report by clicking the corresponding button in the Actions category. This band is displayed at the beginning of every group.

    report-server-add-group-header-band

    You can also accompany each Group Header by a Group Footer band, for instance, to display summary values.

  2. Select the created Group Header, and in the Actions category, click the plus button for the Group Fields property.

    report-server-group-header-add-group-field

  3. Set the Group By property to a data member across which the report should be grouped.

    report-server-group-header-group-by-property

  4. Use the corresponding arrow button in the same way as for the sorting items to manage the sorting order of the group’s items.

    You can also add multiple data fields to this collection to group report data by the distinct combinations of these group field values.

  5. Move the Discount data field specified as the grouping criterion from the Detail band to the Group Header band.

    report-server-group-header-layout

Specify Grouping Options

You can provide nested grouping for report data by creating multiple Group Header bands and specifying different group fields for them. In this scenario, a band’s Level property determines the nesting level. Changing this property for the Group Header created in the previous section changes another Group Header automatically.

report-server-group-header-level-property

The Level property also allows you to associate a Group Header with the corresponding Group Footer.

The Group Union property specifies whether group rows are printed on different pages or the entire group should be printed on a single page. The Keep Together property, in turn, determines whether the contents of the group band can be split horizontally across pages.

Use the Repeat Every Page option to define whether a group band should be shown only on the first page that the group appears or on every page.

View the Result

Click the Preview report-server-web-preview-button toolbar button to see the result. The detail report data has become sorted by product names and grouped based on the grouping criteria value.

report-server-grouping-data-result

See Also