Chart & Visualization Issues

Add a Slicer to Control Categories in an Excel Line Chart

Steven ParkerSteven Parker Nov 12, 2026 872 views

Question details

Create an interactive line chart that lets viewers hide or reveal individual categories through a slicer.

Add a Slicer to Control Categories in an Excel Line Chart
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.
Before you start

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.

Solution 1Recommended

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.

1
Normalize the source data

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.

2
Insert a PivotTable

Select the normalized data, then go to Insert > PivotTable. Choose where to place the PivotTable and select OK.

3
Build the PivotTable layout

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.

4
Create a PivotChart

Click inside the PivotTable, then select Insert > PivotChart. Choose Line and select a line chart style to create the interactive chart.

5
Add the category slicer

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.

Create a PivotChart and connect a category slicer
PivotChart limitation: The available series and layout depend on the PivotChart field arrangement. If the desired chart needs more independent controls than a PivotChart supports, use slicer-driven formulas with a standard chart instead.
Interactive spreadsheet charts

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. 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. 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. 3. Insert a PivotChart: Click the PivotTable and use Insert > PivotChart, then select a Line chart type.
  4. 4. Add a Category slicer: Select the PivotTable or PivotChart, choose the slicer option on the PivotTable tools tab, and select the Category field.
Filter chart categories interactively with a slicer.Create PivotTables and PivotCharts from normalized data.Open and edit Microsoft Excel .xlsx workbooks with compatible formatting.Use a familiar spreadsheet interface for a smooth transition from Excel.
microsoft office alternative - wps office

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.