# Display Top N Values | WPF Controls | DevExpress Documentation

[Pivot Grid](/WPF/7228/controls-and-libraries/pivot-grid) allows you to limit the number of field values to the specified number of topmost values according to the sort order. This can be useful if an end-user does not wish to browse an entire report, and only needs to see the best or worst results. The other values are hidden and are not used to calculate totals.

![pivotgrid_topvalues](/WPF/images/pivotgrid_topvalues11565.png)

[Run Demo: Top Values](dxdemo://Wpf/DXPivotGrid/MainDemo/TopValues)

To restrict the number of field values displayed along a column or row axis, use the [PivotGridField.TopValueCount](/WPF/DevExpress.Xpf.PivotGrid.PivotGridField.TopValueCount) property. By default, this property specifies the absolute number of field values. For example, if there are **20** unique field values and this property is set to **10**, only the **10** top field values will be displayed.

If the [PivotGridField.TopValueType](/WPF/DevExpress.Xpf.PivotGrid.PivotGridField.TopValueType) property is set to [FieldTopValueType.Percent](/WPF/DevExpress.Xpf.PivotGrid.FieldTopValueType), the [PivotGridField.TopValueCount](/WPF/DevExpress.Xpf.PivotGrid.PivotGridField.TopValueCount) property allows you to specify the number of displayed field values as a percentage ratio.

The meaning of this percentage ratio depends on the current data binding mode as follows.

- In a [regular data binding](/WPF/8014/controls-and-libraries/pivot-grid/binding-to-data/binding-to-data-overview) mode, the [PivotGridField.TopValueCount](/WPF/DevExpress.Xpf.PivotGrid.PivotGridField.TopValueCount) property value defines the percentage of the displayed field values among all field values. For instance, if the [PivotGridField.TopValueCount](/WPF/DevExpress.Xpf.PivotGrid.PivotGridField.TopValueCount) property is set to **50**, PivotGridControl will display the first half of field values in the current field.
- In an [OLAP](/WPF/8015/controls-and-libraries/pivot-grid/binding-to-data/olap-data-source/binding-to-olap-data-sources) mode, PivotGridControl will display top values, whose cumulative total is equal to or greater than a specified percentage. For instance, if the [PivotGridField.TopValueCount](/WPF/DevExpress.Xpf.PivotGrid.PivotGridField.TopValueCount) property is set to **50**, PivotGridControl will display values whose cumulative total is not less than a half of the Grand Total value.

To display the remaining values combined into a single item (‘Others’), set the field’s [PivotGridField.TopValueShowOthers](/WPF/DevExpress.Xpf.PivotGrid.PivotGridField.TopValueShowOthers) property to **true**. The ‘Others’ item is displayed below field values.

Note

In an [OLAP](/WPF/8015/controls-and-libraries/pivot-grid/binding-to-data/olap-data-source/binding-to-olap-data-sources) mode, [totals](/WPF/8057/controls-and-libraries/pivot-grid/data-shaping/aggregation/totals) are calculated against all values, even if the **Top N Values** feature is enabled.

## Example: How to Display Top N Values

This example demonstrates how to avoid browsing an entire report, but only show the best or worst results. For this purpose, the [PivotGridControl](/WPF/DevExpress.Xpf.PivotGrid.PivotGridControl) provides the **Top N Values** feature, which can be used to limit the number of displayed field values to the specified number of topmost values according to the sort order.

To enable this feature, the [PivotGridField.TopValueCount](/WPF/DevExpress.Xpf.PivotGrid.PivotGridField.TopValueCount) property must be used. This property allows you to restrict the number of field values that are displayed along the column or row axis.

- MainWindow.xaml

<section id="tabpanel_8R+aU0IEsJ_tabid-xamlMainWindow-xaml" role="tabpanel" data-tab="tabid-xamlMainWindow-xaml">
<pre><code class="lang-xaml">&lt;Window x:Class=&quot;HowToBindToMDB.MainWindow&quot;
        xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
        xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
        xmlns:dxe=&quot;http://schemas.devexpress.com/winfx/2008/xaml/editors&quot;
        xmlns:dxpg=&quot;http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid&quot;
        Title=&quot;MainWindow&quot; Height=&quot;350&quot; Width=&quot;525&quot;  Loaded=&quot;Window_Loaded&quot;&gt;
    &lt;Grid Margin=&quot;7&quot;&gt;
        &lt;dxpg:PivotGridControl HorizontalAlignment=&quot;Left&quot; Name=&quot;pivotGridControl1&quot;
                               VerticalAlignment=&quot;Top&quot;&gt;
            &lt;dxpg:PivotGridControl.Fields&gt;
                &lt;dxpg:PivotGridField x:Name=&quot;fieldCountry&quot; FieldName=&quot;Country&quot; Area=&quot;RowArea&quot;/&gt;
                &lt;dxpg:PivotGridField x:Name=&quot;fieldCustomer&quot; FieldName=&quot;Sales Person&quot; Area=&quot;RowArea&quot;
                                     SortByField=&quot;{Binding ElementName=fieldExtendedPrice}&quot;
                                     Caption=&quot;Customer&quot; TopValueCount=&quot;3&quot;
                                     TopValueShowOthers=&quot;True&quot;
                                     SortOrder=&quot;Descending&quot;/&gt;
                &lt;dxpg:PivotGridField x:Name=&quot;fieldExtendedPrice&quot; FieldName=&quot;Extended Price&quot;
                                     Area=&quot;DataArea&quot; CellFormat=&quot;c0&quot; /&gt;
            &lt;/dxpg:PivotGridControl.Fields&gt;
        &lt;/dxpg:PivotGridControl&gt;
    &lt;/Grid&gt;
&lt;/Window&gt;
</code></pre></section>