[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Collapse]Data Shaping
    [Expand]Aggregation
     Grouping
    [Collapse]Sorting
      Data Sorting
      Sorting by Summary
      Display Top N Values
    [Expand]Filtering
    [Expand]Data Formatting
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Appearance
   [Expand]MVVM Enhancements
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Display Top N Values

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.

To restrict the number of field values displayed along a column or row axis, use the 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 property is set to FieldTopValueType.Percent, the 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 mode, the PivotGridField.TopValueCount property value defines the percentage of the displayed field values among all field values. For instance, if the PivotGridField.TopValueCount property is set to 50, PivotGridControl will display the first half of field values in the current field.
  • In an OLAP mode, PivotGridControl will display top values, whose cumulative total is equal to or greater than a specified percentage. For instance, if the 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 property to true. The 'Others' item is displayed below field values.

Note

In an OLAP mode, totals are calculated against all values, even if the Top N Values feature is enabled.

Expanded Example: How to Display Top N Values

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E2142.

This example demonstrates how to avoid browsing an entire report, but only show the best or worst results. For this purpose, the 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 property must be used. This property allows you to restrict the number of field values that are displayed along the column or row axis.

Is this topic helpful?​​​​​​​