Sorting data at the group level
When you create a group, the default setting specifies sorting the group values by the grouping field in ascending order. For example, if you create an order ID group, the default setting is to sort order ID values in ascending order. You can, however, sort the group values by a different field. For example, rather than sort group values by order ID, you can sort by order total.
Sorting at the group level is different from sorting at the detail row level. To sort at the detail row level, specify the sorting criteria in the Sorting page in Property Editor. To sort at the group level, specify the sorting criteria in the Groups page.
The report in Figure 9‑17 groups sales data by product code. The group header, highlighted by a gray background, displays the product code and the sales total. The product code group uses the default sorting, which sorts by product code in ascending order, such as S10_1678, S10_1949, and so on.
Figure 9‑17 Results of sorting group values in ascending order
The reports in Figure 9‑17 and Figure 9‑18 contain the same data. The report in Figure 9‑18 sorts the data by the product sales total in ascending order, rather than sorting by product code.
Figure 9‑18 Results of changing the sort order of groups
By changing the field on which groups are sorted, you can choose the information to emphasize. As Figure 9‑18 shows, the report can group sales data by product code but list them in order of sales total, which is often a more useful way to present sales information.
How to sort data at the group level
1 Create a group using the instructions in How to group data. Figure 9‑19 shows the group editor. You can specify sorting in two ways. The first way is to specify sorting by the grouping field. The second way enables you to specify a different field by which to sort and also enables you to specify a sort expression.
Figure 9‑19 Sorting options in Edit Group
2 In Filters and Sorting, choose Sorting.
3 Choose Add to specify a sort key.
4 In New Sort Key, specify the sort criteria. This procedure is described earlier in this section. Figure 9‑20 shows an example of a sort definition that sorts group values by sales totals in ascending order.
Figure 9‑20 New Sort Key displaying a sort definition
5 Choose OK to save the sort definition. The sort definition appears in the Sorting section of Edit Group, as shown in Figure 9‑21.
Figure 9‑21 Sorting expression in Edit Group
6 Preview the report.