[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Collapse]Office File API
  Demo Application
  Redistribution and Deployment
 [Collapse]Spreadsheet Document API
   Product Structure
   Getting Started
  [Expand]Spreadsheet Document
   Supported Formats
  [Expand]Cell Basics
  [Expand]Formulas
   Defined Names
   Data Binding
  [Expand]Pivot Tables
  [Expand]Charts and Graphics
  [Expand]Mail Merge
  [Collapse]Examples
   [Expand]Files
   [Expand]Workbooks
   [Expand]Worksheets
   [Expand]Rows and Columns
   [Expand]Cells
   [Expand]Formulas
   [Expand]Import and Export Data
   [Expand]Data Binding
    Sorting
   [Expand]Mail Merge
    Search
   [Expand]Shapes
   [Expand]Charts
   [Expand]Sparklines
   [Expand]Formatting Cells
   [Expand]Conditional Formatting
   [Expand]Group Data
   [Expand]Filter Data
   [Expand]Tables
   [Collapse]Pivot Tables
     How to: Create a Pivot Table
     How to: Refresh a Pivot Table
     How to: Change a Data Source for a Pivot Table
     How to: Move a Pivot Table
     How to: Clear or Remove a Pivot Table
     How to: Change the PivotTable Layout
     How to: Subtotal Fields in a Pivot Table
     How to: Display or Hide Grand Totals for a Pivot Table
     How to: Format Numbers and Dates in a Pivot Table
     How to: Apply a Predefined Style to a Pivot Table
     How to: Apply a Custom Style to a Pivot Table
     How to: Control Style Options
     How to: Change the Summary Function for a Data Field
     How to: Apply a Custom Calculation to a Data Field
     How to: Create a Calculated Field
     How to: Create a Calculated Item
     How to: Sort Items in a Pivot Table
     How to: Filter Items in a Pivot Table
     How to: Group Items in a Pivot Table
   [Expand]Printing
   [Expand]Pictures
   [Expand]Protection
 [Expand]Word Processing Document API
 [Expand]PDF Document API
 [Expand]Excel Export Library
 [Expand]Snap Report API
 [Expand]Zip Compression and Archive API
 [Expand]Barcode Generation API
 [Expand]Unit Conversion API
 [Expand]API Reference
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Filter Items in a Pivot Table

This topic describes how to filter items in a PivotTable report. Different types of filters are available: you show or hide specific items, construct the filter expression to display item labels that meet the given criteria (Label Filters and Date Filters), or filter a field based on summary values in the data area (Value Filters).

The table below describes API members that allow you to apply a filter to a PivotTable field.

Member Description
PivotField.ShowSingleItem Displays the specified item in the PivotTable field.
PivotItem.Visible Specifies whether the current item is displayed in the field.
PivotTable.Filters Provides access to the collection of filters applied to a pivot table.
PivotFilterCollection.Add Applies a filter to the specified row or column field.
PivotFilterType Specifies the type of the filter to be applied to the PivotTable field.
PivotFilter Represents a filter applied to the PivotTable field.
PivotFilter.Field Returns the PivotTable field to which the current filter is applied.
PivotFilter.Value Returns the first filter criteria value.
PivotFilter.SecondValue Returns the second filter criteria value.
PivotFilter.MeasureField Returns the data field used by the current value filter.
PivotFilter.Top10Type Specifies the type of the "Top 10" value filter.

Select the task you wish to perform.

Expanded Show or Hide Specific Items

The following example uses a report filter to filter the entire pivot table to show sales data for the Northeastern region. Before using the report filter, make sure that the corresponding field is added to the report filter area of your PivotTable report.

Expanded Use a Label Filter

The following example demonstrates how to apply a label filter to the "Region" column field to display sales data only for the Southern region.

Tip

To perform more versatile filtering, you can use wildcard characters. The asterisk * matches any number of characters, while the question mark ? represents a single character. To filter labels containing a specific character, such as the asterisk, question mark or tilde, put the tilde (~) before it.

Expanded Use a Date Filter

The following example demonstrates how to apply a filter to the "Date" row field to show sales data for the second quarter.

Expanded Use a Value Filter

The following example demonstrates how to apply a value filter to the "Product" row field to display products whose total sales fall between $6000 and $13000.

Expanded Use a Top 10 Filter

A "Top 10" value filter allows you to display the specified number of top or bottom items in a field (PivotFilterType.Count), show the top or bottom values that contribute to the specified percent of the filtered field's grand total (PivotFilterType.Percent), or filter the top or bottom values that make up a specific sum (PivotFilterType.Sum).

The following example demonstrates how to apply the "Top 10" filter to the "Product" row field to display two products with the lowest total sales.

Expanded Use Multiple Filters per Field

To enable the capability to apply multiple filters to a single row or column field, set the PivotBehaviorOptions.AllowMultipleFieldFilters property to true. By default, this property is false and if you try to apply more than one filter to a PivotTable field, only the last specified filter will be applied.

Expanded Remove a Filter

  • Clear a specific filter

    You can remove a filter applied to a PivotTable field using one of the methods listed in the table below.

    Method Description
    PivotFilter.Delete Removes the current filter from the collection of filters applied to a pivot table.
    PivotFilterCollection.Remove Removes the specified filter from the collection of filters applied to a pivot table.
    PivotFilterCollection.RemoveAt Removes the filter at the specified index from the collection of filters applied to a pivot table.
    PivotField.ShowAllItems Redisplays all items in the specified PivotTable field.
  • Clear all filters

    To remove all filters applied to the row and column fields of the PivotTable report at once, use the PivotFilterCollection.Clear method.

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