| title | Sort data in a data region in a paginated report | |
|---|---|---|
| description | Learn how to change the sort order of data in a data region in a paginated report when a report first runs in Report Builder. | |
| ms.date | 09/25/2024 | |
| ms.service | reporting-services | |
| ms.subservice | report-design | |
| ms.topic | how-to | |
| ms.custom |
|
[!INCLUDEssrs-appliesto] [!INCLUDE ssrs-appliesto-ssrs-rb] [!INCLUDE ssrs-appliesto-pbi-rb] [!INCLUDE ssrb-applies-to-ssdt-yes]
To change the sort order of data in a data region when a paginated report first runs, you must set the sort expression on the data region or group. By default, the sort expression for a group is automatically set to the same value as the group expression.
-
In a tablix data region, set the sort expression for the data region or for each group, including the details group. If you have only one details group in a tablix data region, you can define a sort expression in the query, on the data region, or on the details group and they all have the same effect.
-
In a chart data region, set the sort expression for the Category and Series groups to control the sort order for each group. The order for colors in a chart legend is determined by the sort expression for the data points in the Category group.
-
In a gauge data region, you do not typically need to sort data because the gauge displays a single value relative to a range. If you do need sort data in a gauge, you must first define a group, and then set the sort expression for the group.
For more information, see Filter, Group, and Sort Data (Report Builder and SSRS).
For a tablix data region, you can also add an interactive sort button to the top of a column header to provide the user with the ability to change the sort order of groups or detail rows. For more information, see Interactive Sort (Report Builder and SSRS).
Note
[!INCLUDEssRBRDDup]
-
On the design surface, right-click a row handle, and then click Tablix Properties.
-
Click Sorting.
-
For each sort expression, follow these steps:
-
Click Add.
-
Type or select an expression by which to sort the data.
-
From the Order column drop-down list, choose the sort direction for each expression. A-Z sorts the expression in ascending order. Z-A sorts the expression in descending order.
-
-
Select OK.
-
On the design surface, click in the tablix data region to select it. The Grouping pane displays the row groups and column groups for the Tablix data region.
-
In the Row Groups pane, right-click the group name, and then click Edit Group.
-
In the Tablix Group dialog box, click Sort.
-
For each sort expression, follow these steps:
-
Click Add.
-
Type or select an expression by which to sort the data.
-
From the Order column drop-down list, choose the sort direction for each expression. A-Z sorts the expression in ascending order. Z-A sorts the expression in descending order.
-
-
Select OK.
-
Right-click a field in the Category Field drop-zone and click Category GroupProperties.
-
In the Category Group Properties dialog box, click Sorting.
-
For each sort expression, follow these steps:
-
Click Add.
-
Select the expression that matches your grouping field. You can verify the expression for the grouping field by clicking Grouping.
-
From the Order column drop-down list, choose the sort direction for each expression. A-Z sorts the expression in ascending alphabetical order. Z-A sorts the expression in descending alphabetical order.
-
-
Select OK.
-
Right-click a field in the Category Field drop zone and click Category GroupProperties.
-
In the Category Group Properties dialog box, click Sorting.
-
For each sort expression, follow these steps:
-
Click Add.
-
Select the expression that matches your data field. In most cases, this is an aggregated value, such as
=Sum(Fields!Quantity.Value). -
From the Order column drop-down list, choose the sort direction for each expression. A-Z sorts the expression in ascending order. Z-A sorts the expression in descending order.
-
-
Select OK.
-
Right-click the gauge and click Add Data Group.
-
In the Gauge Panel GroupProperties dialog box, click General if necessary.
-
In Group expressions, click Add.
-
In Group on, type or select an expression by which to group the data.
-
Repeat steps 3 and 4 until you have added all the group expressions you want to use.
-
Click Sorting.
-
For each sort expression, follow these steps:
-
Click Add.
-
Select the expression that matches your grouping field. You can verify the expression for the grouping field by clicking Grouping.
-
From the Order column drop-down list, choose the sort direction for each expression. A-Z sorts the expression in ascending order. Z-A sorts the expression in descending order.
-
-
Select OK.
For more information about how data is grouped in a gauge, see Gauges (Report Builder and SSRS).