How to Add a Slicer for PivotChart Values or Legend Items in Excel
Question details
The user wants to add a slicer to dynamically filter and control the visibility of individual value fields or legend items within a PivotChart.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Creating dynamic dashboards or charts where users need to show or hide specific chart lines or data series interactively.
- Observed behavior
- Excel does not natively support adding slicers directly to value fields or legend series in a PivotChart, requiring a data restructuring workaround.
Ensure your source data is formatted as an Excel Table (Ctrl+T) before proceeding, as this makes it easier to import into Power Query and apply transformations.
Use Power Query to Unpivot Columns
Restructure your source data using Power Query so that the series you want to slice are converted into a single column, allowing you to add a standard slicer.
Because Excel designs slicers to filter dimension fields (rows/columns) rather than measure fields (values), you must normalize your dataset. Unpivoting the data creates an 'Attribute' column that can be used by a slicer.
Select your data table and navigate to the 'Data' tab. Click on 'From Table/Range' to open the Power Query Editor.
In the Power Query Editor, select the identifier columns (the ones you do not want to slice). Go to the 'Transform' tab and click 'Unpivot Other Columns' (or select the specific value columns and choose 'Unpivot Columns').
Go to the 'Home' tab and click 'Close & Load' to return the transformed dataset back to a new worksheet in Excel.
Insert a new PivotTable and PivotChart from the loaded data. Drag the new 'Attribute' field into the Legend (Series) area, and then insert a slicer for the 'Attribute' field to toggle your values dynamically.

Apply a VBA Macro Workaround
Use a custom VBA macro to create a pseudo-slicer for users comfortable with coding and enabling macros.
Analyze Data Easily with WPS Office
While advanced data reshaping like Power Query is native to Microsoft Excel, WPS Office provides a lightweight, highly compatible, and free alternative for standard PivotTable and dashboarding needs. Enjoy a familiar interface without the heavy subscription fees.
- 1. Download and install: Get WPS Office for free from the official website and install it on your device.
- 2. Open your spreadsheet: Open your existing .xlsx files directly in WPS Spreadsheet with zero formatting loss.
- 3. Insert PivotTables: Navigate to the Insert tab to seamlessly create PivotTables and add standard slicers to filter your data.

Frequently Asked Questions
Why can't I add a slicer to PivotChart values directly?
Spreadsheet software natively designs slicers to filter dimension fields (like categories in rows or columns) rather than measure fields (the actual numerical values). To filter values dynamically, the data must be unpivoted first.
Does unpivoting columns affect my original data?
No. When you use Power Query to unpivot columns, it creates a separate, transformed dataset. Your original source data remains completely untouched.
Can I hide legend items without using a slicer or Power Query?
Yes, you can manually use the filter button directly on the PivotChart to check or uncheck specific legend series. However, this is less interactive and not as visually appealing as using a slicer on a dashboard.




