Add slicers to pivot tables
Refer to the following example code to see how to create slicer for a Pivot Table.