PivotFilter Interface
Represents a filter applied to a PivotTable field.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.1.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Related API Members
The following members return PivotFilter objects:
Remarks
The PivotFilter objects are stored in the PivotFilterCollection collection, which can be accessed using the PivotTable.Filters property.
To create a new filter and apply it 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 items that meet the specified criteria (Label Filters and Date Filters), or filter report data based on calculated values (Value Filters).
The example below demonstrates how to apply a label filter to the “Region” field to display sales data only for the Southern region.
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")
To remove a specific filter, you can either use the filter’s PivotFilter.Delete method or the Remove/RemoveAt methods of the PivotFilterCollection collection.