Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Collapse]Spreadsheet
   [Expand]Product Information
    Product Structure
    Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Spreadsheet Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Printing
    Events
   [Expand]Mail Merge Overview
    Protection
    Find and Replace
   [Expand]Visual Elements
    Services
   [Expand]Shortcuts
   [Collapse]Examples
    [Expand]Files
    [Expand]Workbooks
    [Expand]Worksheets
    [Expand]Rows and Columns
    [Expand]Cells
    [Expand]Formulas
    [Expand]Import and Export Data
    [Expand]Data Binding
    [Expand]Mail Merge
    [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: 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]Charts
    [Expand]Protection
    [Expand]Customization
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Filter Items in a Pivot Table

The Spreadsheet Control provides numerous ways to filter items in a pivot table. 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.

Show Me

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

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.

Show Me

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

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.

Show Me

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

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.

Show Me

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

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.

Show Me

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

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.

How would you rate this topic?​​​​​​​