Skip to main content

Sorting

  • 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.

DataShaping_Sorting_Arrow

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

DataShaping_Sorting_ContextMenu

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.

Dimension continentDimension = 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.

DataShaping_Sorting_SortByMeasure

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.

Dimension continentDimension = new Dimension("Continent");
Measure amountMeasure = new Measure("Amount", SummaryType.Sum);
continentDimension.SortByMeasure = amountMeasure;
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.

DimensionAttribute_Sorting

  • 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:

    • (Value) - sorting is performed by member values;
    • (Display Text) - soring is performed by captions associated with members;
    • (Key) - sorting is performed by member keys;
    • (ID) - sorting is performed by member IDs.

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

API Description
Dimension.SortOrder Gets or sets the sort order of dimension values.
Dimension.SortByMeasure Gets or sets a Measure by which values of this data item should be sorted.
DimensionSortOrder Lists values that specify the sort order for dimension values.