Back to Devexpress

Top N

dashboard-15696-winforms-dashboard-winforms-designer-create-dashboards-in-the-winforms-designer-data-shaping-top-n.md

latest4.6 KB
Original Source

Top N

  • Dec 22, 2020
  • 2 minutes to read

The Top N feature allows you to display only a limited number of values that correspond to the highest or lowest values of a particular measure.

To display the top values in a dimension, select Top N from the data item menu.

This invokes the Top N Values dialog.

In this dialog, check the Enabled check box and specify the following settings.

|

Mode

|

Specifies whether top or bottom values should be displayed.

| |

Count

|

The number of values to be displayed.

| |

Measure

|

The parameter according to which the top or bottom values will be determined.

| |

Show “Others” value

|

If enabled, all values that are not the top/bottom ones are consolidated in the “Others” value.

Note

Note that this capability is not supported in OLAP mode.

|

You can use the hidden measure as a parameter according to which the top or bottom values will be determined.

To configure the Top N feature in code, use the Dimension.TopNOptions property. This property returns a DimensionTopNOptions object that exposes the following properties.

|

DimensionTopNOptions.Enabled

|

Gets or sets whether the Top N Values feature is enabled.

| |

DimensionTopNOptions.Mode

|

Gets or sets whether the smallest or largest values should be displayed.

| |

DimensionTopNOptions.Count

|

Gets or sets the number of top or bottom values to be displayed.

| |

DimensionTopNOptions.Measure

|

Gets or sets the Measure by whose values the dimension values are ranged.

| |

DimensionTopNOptions.ShowOthers

|

Gets or sets whether to show the “Others” value.

|

The following code snippet shows how to display 3 sales persons with the largest Extended Price summaries.

csharp
Dimension salesPersonDimension = new Dimension("Sales Person");
Measure extendedPriceMeasure = new Measure("Extended Price");
//...
salesPersonDimension.TopNOptions.BeginUpdate();
salesPersonDimension.TopNOptions.Enabled = true;
salesPersonDimension.TopNOptions.Count = 3;
salesPersonDimension.TopNOptions.Measure = extendedPriceMeasure;
salesPersonDimension.TopNOptions.EndUpdate();
vb
Dim salesPersonDimension As New Dimension("Sales Person")
Dim extendedPriceMeasure As New Measure("Extended Price")
'...
salesPersonDimension.TopNOptions.BeginUpdate()
salesPersonDimension.TopNOptions.Enabled = True
salesPersonDimension.TopNOptions.Count = 3
salesPersonDimension.TopNOptions.Measure = extendedPriceMeasure
salesPersonDimension.TopNOptions.EndUpdate()

Limitations

The “Others” value has the following limitations:

  • You cannot set the “Others” element as a Master Filter value.
  • Drill down by this value is not supported.
  • You cannot obtain Underlying data only for the “Others” value. As an alternative, use the Data Inspector to obtain underlying data for the whole dashboard item.

API Members

APIDescription
Dimension.TopNOptionsProvides access to the Top N settings.
DimensionTopNOptionsContains the Top N settings.