How to Use a Measure as a Slicer in Power BI
Have you ever wanted to filter a Power BI report based on a calculation, like showing only customers who spent over $1,000 or products with more than 100 units sold? If you've tried dragging a measure into a slicer, you know Power BI doesn't allow it. This article will show you the most common and effective workaround, allowing you to create dynamic, interactive reports that filter visuals based on the results of your DAX measures.
Why Can't You Use a Measure in a Slicer?
First, it helps to understand the "why." Slicers in Power BI are designed to work directly on the columns within your tables. When you select a value in a slicer - like a product category, a date, or a region - Power BI applies a straightforward filter to the underlying data column. This process is highly optimized and fast.
Measures, on the other hand, are different. They are dynamic calculations that respond to the "filter context" of your report. A measure like [Total Sales] doesn't have a fixed value, its result changes depending on what you've selected in your other slicers, what's in a given row of a table, or where it sits on a chart axis. Since the measure's results aren't a static list of values in a column, it can't be used as a direct filtering source for a slicer.
So, how do we get around this? We create a "virtual" slicer using a clever combination of a disconnected table and a DAX measure.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
The Method: Using a Disconnected Table for Control
The solution involves creating a small, separate table that is not related to any other tables in your data model. This table will contain the categories or options you want to display in your slicer. We’ll then write a DAX measure that checks which option is selected in this new slicer and applies the corresponding logic to filter our visuals.
Think of it like this: the slicer itself doesn't actually filter the data. Instead, it acts as an input for a DAX measure, which then does the real work of determining what to show or hide in your charts and tables.
Step-by-Step Guide: Filtering a Customer List by Sales Value
Let's walk through a common business scenario: you have a list of customers, and you want to use a slicer to view different groups based on their total spending. You want to see "High Value" (greater than $5,000), "Medium Value" ($1,000-$5,000), and "Low Value" (<$1,000) customers.
Let's assume you already have a simple data model with a Sales table and a Customers table, and you have created a basic measure to calculate total sales:
Total Sales = SUM(Sales[Revenue])Step 1: Create the Disconnected Slicer Table
First, we need a table to hold our slicer options. This table isn't going to come from your primary data source, we’ll create it right inside Power BI.
- In the Home ribbon, click on Enter Data.
- A "Create Table" window will appear. Name the first column something descriptive, like
Customer Sales Tier. - Under this column, enter the labels you want to see in your slicer. For our example, let's add three rows:
- Name the table itself. Let's call it
Sales Slicer. Your setup should look something like this:
Click Load. You will now see the Sales Slicer table in your Fields pane. Crucially, do not create any relationships between this new table and any other tables in your model. It needs to remain disconnected.
Step 2: Add the Slicer to Your Report
Now, let's create the slicer on our report canvas.
- Select the Slicer visualization from the Visualizations pane.
- Drag the
Customer Sales Tiercolumn from your newSales Slicertable into the "Field" well of the slicer visual.
You'll see a slicer on your page with the three options we created. Go ahead and click on them. You'll notice... nothing happens. That's expected! The slicer is broadcasting a selection, but nothing is "listening" for it yet. That's our next step.
Step 3: Create the DAX Filtering Measure
This is where the magic happens. We need to create a new DAX measure that connects the selection from our slicer to our [Total Sales] measure. This measure will return a value (like 1) if the customer in a given row meets the criteria of the selected slicer option, and another value (like 0 or BLANK()) if they don't.
- Right-click on your
Salestable (or wherever you store your measures) and select New Measure. - Enter the following DAX formula in the formula bar. We'll break it down piece by piece below.
Filter Customers by Sales =
VAR SelectedTier = SELECTEDVALUE('Sales Slicer'[Customer Sales Tier])
VAR CustomerTotalSales = [Total Sales]
RETURN
SWITCH(
TRUE(),
SelectedTier = "High Value Customers" && CustomerTotalSales > 5000, 1,
SelectedTier = "Medium Value Customers" && CustomerTotalSales >= 1000 && CustomerTotalSales <= 5000, 1,
SelectedTier = "Low Value Customers" && CustomerTotalSales < 1000, 1,
0
)Breaking Down the DAX Formula:
- VAR SelectedTier = SELECTEDVALUE('Sales Slicer'[Customer Sales Tier]): This creates a variable called
SelectedTier. TheSELECTEDVALUEfunction checks theCustomer Sales Tiercolumn in our slicer. If only one value is selected (e.g., "High Value Customers"), it returns that text value. If nothing is selected or multiple values are, it returns a blank. - VAR CustomerTotalSales = [Total Sales]: This simply stores the result of our
[Total Sales]measure in a variable for easier reference. When this measure is evaluated for each customer in our table visual, this will reflect that specific customer's total sales. - RETURN SWITCH(TRUE(), ...): The
SWITCHfunction is a clean way to handle multiple IF/THEN conditions. It checks each condition in order, and the first one that is true determines the result. - Conditions: Each line inside the
SWITCHfunction checks two things: - fallback_value,
0: If none of the conditions are met, theSWITCHfunction will return the final value, which is0in our case.
Step 4: Use the Measure as a Visual-Level Filter
We've built all the components. The final step is to tell our customer table visual to pay attention to our new DAX measure.
- Create a table visual on your report that shows
Customer Namefrom yourCustomerstable and our[Total Sales]measure. - Click to select this new table visual so it's active.
- Go to the Filters pane. You will see a section called "Filters on this visual".
- Find your new
[Filter Customers by Sales]measure in the Fields pane and drag it into the "Filters on this visual" section. - Expand the new filter card. Change the "Show items when the value" dropdown to is and type
1in the box. - Click Apply filter.
And that's it! Now, when you select an option in your Sales Slicer, the [Filter Customers by Sales] measure will return a 1 only for customers in that sales tier. The visual-level filter will then hide all rows where the measure is not 1, effectively filtering your customer list based on your slicer selection.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Improving the User Experience: Handling the "Nothing Selected" State
Try clearing your slicer selection. You'll probably see a blank table. This is because when nothing is selected, our SelectedTier variable is blank, so none of our conditions are met and the measure returns 0 for all customers.
We can easily fix this by making a small change to our DAX measure to show all customers when a selection is cleared.
Filter Customers by Sales (Improved) =
VAR SelectedTier = SELECTEDVALUE('Sales Slicer'[Customer Sales Tier])
VAR CustomerTotalSales = [Total Sales]
-- If nothing is selected, show all
IF(
ISBLANK(SelectedTier),
1,
-- Otherwise, evaluate conditions
SWITCH(
TRUE(),
SelectedTier = "High Value Customers" && CustomerTotalSales > 5000, 1,
SelectedTier = "Medium Value Customers" && CustomerTotalSales >= 1000 && CustomerTotalSales <= 5000, 1,
SelectedTier = "Low Value Customers" && CustomerTotalSales < 1000, 1,
0
)
)Adding an IF(ISBLANK(SelectedTier), 1, ...) check at the beginning makes the measure default to showing everything when the slicer is cleared, which often provides a more intuitive user experience.
Final Thoughts
This technique of combining a disconnected slicer table with a switching DAX measure is incredibly powerful. You can now filter report visuals by any business logic you can define with DAX—such as sales performance, inventory levels, or customer activity—opening up a whole new level of interactivity and analysis for your Power BI reports.
Learning the intricacies of DAX and building complex filtering logic like this is a big part of extracting value from business intelligence tools. We know firsthand that this can be time-consuming, especially for teams that need quick answers. At Graphed, we’ve integrated this logic into our platform, allowing you to connect your data sources and create deeply filtered dashboards just by asking questions in plain English. No need to create disconnected tables or write complex SWITCH statements — just describe what you want to see, and let AI build the live, interactive visuals for you.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.