Top N

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.

DataShaping_TopN_MenuItem

This invokes the Top N Values dialog.

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

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();