Download the KPI Slicer Workbook
Get the Excel file from the video with the finished dashboard: the data model, the DAX measures and the KPI slicer, ready to explore or reuse in your own reports.
As usual, we start with a dataset.
You need Excel for Windows for this technique. Power Pivot and the Data Model aren’t available in Excel for Mac. If you don’t see the Power Pivot tab, turn it on under File > Options > Add-ins > COM Add-ins.

Step 1: Create a Pivot Table Using the Data Model
Our first step is to create a Pivot Table, but not just a regular Pivot Table. We want to incorporate the use of the Data Model with this Pivot Table to give the result additional abilities.
Our dataset is a proper Excel Table named “Orders”.

We click anywhere in the table and select Table Design (tab) -> Tools (group) -> Summarize with Pivot Table.

In the PivotTable dialog box, leave all the existing settings as-is with the addition of checking the box labeled “Add this data to the Data Model” and click OK.

Now we can work with a “Power Pivot” Table instead of a regular Pivot Table.
New to the data model? See how to build a pivot table from multiple sheets with relationships.
Step 2: Create the KPI Measures With DAX
Now that we have loaded our data into the Data Model, we will use this to create Measures in the model that will help us control the KPI Slicer.
Number of Orders Measure (COUNTROWS)
Select Power Pivot (tab) -> Calculations (group) -> Measures -> New Measure.

In the Measure dialog box, create the three KPI measures first. The slicer comes after that.
Our first KPI will be called “Number of Orders” and use the following formula:
=COUNTROWS(Orders)
After clicking OK, we see the “Number of Orders” KPI added to the existing Power Pivot Table showing the total number of all orders.

Let’s subdivide this total by placing the “Company Name” field in the Rows zone.

Product Count Measure (DISTINCTCOUNT)
Select Power Pivot (tab) -> Calculations (group) -> Measures -> New Measure.
Our second KPI will be called “Distinct Count of Product” and use the following formula:
=DISTINCTCOUNT(Orders[Product])
After clicking OK, we see the “Distinct Count of Product” KPI added to the existing Power Pivot Table showing the number of distinct items sold by each company.

Total Quantity Measure (SUM)
Select Power Pivot (tab) -> Calculations (group) -> Measures -> New Measure.
Our third KPI will be called “Total Quantity” and use the following formula:
=SUM(Orders[Quantity])
After clicking OK, we see the “Total Quantity” KPI added to the existing Power Pivot Table showing the total number of ordered items sold by each company.

You could format each measure now, but there’s no need. These three only feed the final KPI measure, so you’ll format that one at the end.
Step 3: Create a Table With the KPI Names
We want to represent the column headings of the Power Pivot Table as the text on the Slicer buttons.

Since we only have three items, and our list is static, we’ll avoid the complexity of creating a dynamically updating list and simply type a small list of what we want to be displayed on our Slicer buttons.

Format the newly created list of Views as an Excel Table (Ctrl+T) and name the table “View”.

Step 4: Add the View Table to the Data Model
We need to add the newly created Excel Table named “View” to the Data Model.
To do this, with the “View” table selected, click Power Pivot (tab) -> Tables (group) -> Add to Data Model.

We see the “View” table added to the Data Model.

Close the Power Pivot window and return to Excel.
Step 5: Create a Slicer From the View Table
Now that we have added the “View” table to the Data Model, we can use it as a Slicer to control the filtering of the Power Pivot Table.
In the Pivot Table Fields panel, select the “All” category at the top and expand the “View” table to reveal the “View” field.

Right-click on the “View” field and select “Add as Slicer”.

Clicking the buttons on the Slicer does not affect the Power Pivot Table because we have yet to link the “View” Slicer to the “Orders” table in the Data Model.

Step 6: Create the Measures That Read the Slicer
Now that the slicer exists, we need two more measures. The first reads which button is selected in the slicer. The second uses that selection to show the matching KPI.
Slicer Measure (VALUES and HASONEVALUE)
Select Power Pivot (tab) -> Calculations (group) -> Measures -> New Measure.
In the Measure dialog box, our measure will be created in the “View” table and be called “Slicer” and use the following formula:
=VALUES(View[View])
After we click OK, we can see that the Slicer’s single selection is displayed for each of the “Company Names”.
NOTE: If you are receiving an error when adding the Slicer “View” to the Values zone in the Power Pivot Table, make sure you have only a single button selected in the slicer. Selecting more than one button in the Slicer will result in the following error.

To combat this issue of multiple selections in the Slicer, we will change the formula driving the “View” Slicer to ignore multiple button selections.
Select Power Pivot (tab) -> Calculations (group) -> Measures -> Manage Measure.

Select the “Slicer” measure and click Edit.

To ensure that only one Slicer button (i.e., condition) is selected, update the formula as follows:
=IF(HASONEVALUE(View[View]), VALUES(View[View]) )
HASONEVALUE checks that exactly one button is selected. If it is, VALUES returns that button’s text. If not, the IF has no third argument, so it returns a blank instead of an error.
When tested, selecting more than one button in the Slicer yields nothing in the table.

KPI Measure (SWITCH)
Select Power Pivot (tab) -> Calculations (group) -> Measures -> New Measure.
In the Measure dialog box, our measure will be created in the “Orders” table and be called “KPI” and use the following formula:
=SWITCH([Slicer], "Number of Orders", [Number of Orders], "Product Count", [Distinct Count of Product], "Quantity Sold", [Total Quantity])The text in quotes must match the entries in the View table exactly, spaces included. If it doesn’t, SWITCH finds no match and the cell stays blank.
Under Formatting Options, choose Number, then Whole Number, and check Use 1000 separator. This is the only measure that needs formatting, because it’s the one the chart shows.


Show Only the KPI Measure in the Values Area
We next need to update the Power Pivot Table to only contain the KPI measure in the VALUES zone.
Remove the existing entries in the VALUES zone leaving only the KPI measure.

The result is a Power Pivot Table like the following.
You may see a message saying relationships between tables may be needed. You can ignore it. The View table is a disconnected table on purpose. It only feeds the slicer, so it doesn’t need a relationship with the Orders table.

Step 7: Insert the Pivot Chart
Now it’s time to create the chart that will dynamically display and react to our KPI Slicer selection.
Click anywhere in the Power Pivot Table and select Insert (tab) -> Charts (group) -> Clustered Column Chart.

The inserted chart appears as follows:

To move both to your report sheet, hold Ctrl, select the chart and the slicer, press Ctrl+X, then paste them on the report sheet with Ctrl+V.
Clean Up the Chart
Let’s apply the following cosmetic changes to the chart to make it more visually appealing:
- Remove the Legend
- Remove the Chart Title
- Remove the Major Horizontal Gridlines
- Remove the Vertical Axis
- Make the Horizontal Axis labels Bold
- Hide the Field Buttons (PivotChart Analyze (tab) -> Show/Hide (group) -> Field Buttons -> Hide All)
- Add Data Labels (right-click any bar and select Add Data Labels)
- Reduce the size of the Plot Area to provide some space above the chart. This area will be used to display the Slicer buttons.

For more ways to tidy up your reports, see these 10 Excel pivot table tips.
Step 8: Place the Slicer on Top of the Chart

Select the KPI Slicer and apply the following customizations:
- Bring the KPI Slicer to the front-most layer (right-click and select Bring to Front)
- Set the Columns option to 3
- Remove the Slicer heading (right-click -> Slicer Settings -> uncheck Display Header)
- Resize to produce the look below
Remove the Slicer Border
There is no single click to hide the border around a slicer. To make the buttons float above the chart columns, duplicate the current Slicer Style, remove its border and apply the new style.
- Right-click on the highlighted Slicer Style and select Duplicate.
- Give the new Slicer Style a name, such as “Slicer No Border”.
- Select the Slicer Element “Whole Slicer” and click Format.

The updated Modify Slicer Style dialog box should appear as follows:

Clicking OK will commit the updates but the newly created Slicer style will not be applied to the existing Slicer.
To assign the newly created Slicer style to the existing Slicer, select Slicer (tab) -> Slicer Styles (group) -> “Slicer No Border”.

The updated chart looks much better with the new Slicer style.

As an extra bit of chart polish, let’s sort the columns in the chart in descending order.
Right-click any column in the chart and select Sort -> Sort Largest to Smallest.

Test the KPI Slicer
Click the various Slicer buttons to test the functionality.

Want a formula-based option instead? These Excel radio buttons switch charts with one click, no data model needed.
Download the KPI Slicer Workbook
Get the Workbook From the Video
See every measure and the slicer setup in one finished file.
Frequently Asked Questions
How do I change the measure in a pivot chart with a slicer?
Add the data to the data model, list your KPI names in a separate table and add it to the data model as a slicer. Then create a DAX measure that reads the slicer selection with VALUES and a second measure that uses SWITCH to return the matching KPI. Show only that KPI measure in the chart.
Can a slicer switch between different values in a pivot table?
Not on its own, because a normal slicer only filters the data. A slicer from a disconnected table plus a SWITCH measure in Power Pivot lets the slicer decide which value the pivot table shows.
Why do I get a multiple values error from VALUES in DAX?
VALUES returns a table. When more than one slicer button is selected, it returns several values where one is expected. Wrap it in IF(HASONEVALUE(View[View]), VALUES(View[View])) so the measure returns a blank instead.
Do I need Power Pivot to use DAX measures in Excel?
You need the data model, which comes with Power Pivot in Excel for Windows. Power Pivot is not available in Excel for Mac, so this technique only works on Windows.
What is a disconnected table in Excel?
It is a table in the data model with no relationship to your data. It is used only to feed a slicer, and DAX measures read its selection. Excel may suggest a relationship, but you can ignore that message.
How do I remove the border from an Excel slicer?
On the Slicer tab, right-click the current slicer style and choose Duplicate. Select Whole Slicer, click Format and set the border to None. Then apply the new style to the slicer.
Leila Gharani
Founder of XelPlus and ten-time Microsoft MVP. Leila helps over 500,000 professionals master Excel, Power BI, and data automation through practical, real-world training.











