Add a Slicer to Control Categories in an Excel Line Chart
Question details
Create an interactive line chart that lets viewers hide or reveal individual categories through a slicer.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The source data contains multiple categories that need to be selectively displayed in a line chart.
- Observed behavior
- A standard Excel chart does not provide a direct slicer control for individual category series without using a PivotTable and PivotChart structure.
Arrange the source range with clear headers and convert wide category columns into a normalized table with separate Category and Value fields. Ensure the date or period field is also available for the chart axis.
Create a PivotChart and connect a category slicer
Use this method when you want the slicer to directly filter the categories displayed in an interactive line chart.
Slicers work with PivotTables and PivotCharts. If each category is currently stored in a separate column, first reshape the data so that category names are listed in one Category column and their corresponding numbers are listed in one Value column.
Create a table with fields such as Date, Category, and Value. Each category-date combination should occupy one row; for example, place the category name in the Category column and its numeric result in the Value column.
Select the normalized data, then go to Insert > PivotTable. Choose where to place the PivotTable and select OK.
In the PivotTable Fields pane, drag Date to Rows or Axis, drag Category to Columns or Legend, and drag Value to Values. Confirm that Value is summarized correctly, such as Sum or Average.
Click inside the PivotTable, then select Insert > PivotChart. Choose Line and select a line chart style to create the interactive chart.
Select the PivotTable or PivotChart, then go to PivotTable Analyze > Insert Slicer. Select Category and click OK. Use the slicer buttons to show or hide categories in the PivotChart.

Use slicer selections with formulas and a standard line chart
Use this method when you need a standard chart with a more customized layout or more flexible filtering behavior than a PivotChart provides.
Create a Slicer-Controlled Line Chart in WPS Spreadsheet
WPS Spreadsheet can help you build an interactive category chart by using normalized source data, a PivotTable, a PivotChart, and a Category slicer. Select categories in the slicer to control which series are visible in the chart.
- 1. Prepare normalized data: In WPS Spreadsheet, organize the source into columns such as Date, Category, and Value, with one category value per row.
- 2. Create a PivotTable: Select the data range and choose Insert > PivotTable, then place Date in rows, Category in columns, and Value in values.
- 3. Insert a PivotChart: Click the PivotTable and use Insert > PivotChart, then select a Line chart type.
- 4. Add a Category slicer: Select the PivotTable or PivotChart, choose the slicer option on the PivotTable tools tab, and select the Category field.

Frequently Asked Questions
Can I add a slicer directly to a regular Excel line chart?
Not directly. Excel slicers are designed for PivotTables, PivotCharts, and Excel Tables. To filter line-chart categories with a slicer, create a PivotChart or use formulas that feed a standard chart.
Why should I unpivot data before creating a slicer-controlled chart?
A slicer filters values in one field. Place all category names in a single Category column and all measurements in a Value column so the slicer can filter each category consistently.
How do I make one category appear as a separate line in the PivotChart?
In PivotTable Fields, place Category in Columns or Legend (Series), Date in Rows or Axis, and Value in Values. Each category should then appear as a separate chart series.
Can users select more than one category in the slicer?
Yes. Click the slicer's Multi-Select button, then select multiple category buttons. You can also use Ctrl while selecting items in supported Excel versions.
What should I do if my PivotChart does not show the expected series?
Check the PivotTable field layout. Move Category to Legend (Series), put the date or period field on Axis, and verify that the numeric field is in Values rather than Rows or Filters.




