Provides access to the collection of filters applied to the current pivot table.
A PivotFilterCollection object that is a collection of pivot filters.
Use the Filters property to access the collection of filters applied to the specified PivotTable report. To add a new filter to a specific row or column field in the pivot table, use the PivotFilterCollection.Add method overloads. Different types of filters are available: you can construct the filter expression to display only items that meet the specified condition (Label Filters and Date Filters), or filter report data based on calculated values (Value Filters).
To remove a filter from a PivotTable field, use the PivotFilter.Delete method or remove the filter from the PivotFilterCollection collection by using the PivotFilterCollection.Remove or PivotFilterCollection.RemoveAt method. Note that you can also use the PivotField.ShowAllItems method to redisplay all items in a filtered field.
To clear all filters applied to the PivotTable fields, call the PivotFilterCollection.Clear method.
Dim worksheet As Worksheet = workbook.Worksheets("Report4") workbook.Worksheets.ActiveWorksheet = worksheet ' Access the pivot table by its name in the collection. Dim pivotTable As PivotTable = worksheet.PivotTables("PivotTable1") ' Access the "Region" field. Dim field As PivotField = pivotTable.Fields(0) ' Filter the "Region" field by text to display sales data for the "South" region. pivotTable.Filters.Add(field, PivotFilterType.CaptionEqual, "South")
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Filters property.
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.