Back to Devexpress

Sorting

dashboard-15694-winforms-dashboard-winforms-designer-create-dashboards-in-the-winforms-designer-data-shaping-sorting.md

latest4.5 KB
Original Source

Sorting

  • Aug 06, 2021
  • 2 minutes to read

The DevExpress Dashboard allows you to easily change the sort order of values within a dashboard item. You can also enable sorting by measure values.

Changing Sort Order

The sort order of dimension values is indicated with an arrow.

To change the sort order in the Designer, click the data item. You can also toggle sorting from the data item menu.

To sort dimension values in code, use the Dimension.SortOrder property.

The following code snippet show how create a new dimension and set its sort order to DimensionSortOrder.Descending.

csharp
Dimension continentDimension = new Dimension("Continent");
continentDimension.SortOrder = DimensionSortOrder.Descending;
vb
Dim continentDimension As New Dimension("Continent")
continentDimension.SortOrder = DimensionSortOrder.Descending

Sorting by Measure Values

Dashboard allows you to sort dimension values by summary values calculated for a specific measure.

To enable sorting by measure in the Designer, use the Sort by submenu in the dimension’s menu.

To do this in code, assign the measure to the Dimension.SortByMeasure property.

The following code snippet shows how to sort values of the Continent dimension by summary values calculated for the Amount measure.

csharp
Dimension continentDimension = new Dimension("Continent");
Measure amountMeasure = new Measure("Amount", SummaryType.Sum);
continentDimension.SortByMeasure = amountMeasure;
continentDimension.SortOrder = DimensionSortOrder.Descending;
vb
Dim continentDimension As New Dimension("Continent")
Dim amountMeasure As New Measure("Amount", SummaryType.Sum)
continentDimension.SortByMeasure = extendedPriceMeasure
continentDimension.SortOrder = DimensionSortOrder.Descending

You can also sort dimension values by the values of hidden measures.

Note

Sorting by measure cannot be applied if the target measure has a calculation applied.

OLAP Sorting Specifics

In OLAP mode, you can use the following options to specify the sort order for attribute members.

  • No Sorting - Specifies the default server sorting for the current attribute.
  • Sort by - Allows you to choose the OLAP member property by whose values sorting is performed:

To specify the sort mode for attribute members in code, use the Dimension.SortMode property. To sort attribute members, use the Dimension.SortOrder property.

API Members

APIDescription
Dimension.SortOrderGets or sets the sort order of dimension values.
Dimension.SortByMeasureGets or sets a Measure by which values of this data item should be sorted.
DimensionSortOrderLists values that specify the sort order for dimension values.