How to Highlight Data Dynamically in Power BI with A Slicer
Highlight Instead of Filtering
In this tutorial, I want to show you a simple but powerful trick in Power BI: how to use a slicer to highlight a bar in a bar chart instead of filtering it.
It’s one of those small tweaks that can have a big impact on how you present your data (and how easy it is for the end-user to understand it).
I’ve been teaching this technique in workshops for a long time, and I finally found the opportunity to create an article and a video on it (see the link at the bottom of the page).
Before continuing, I want to mention that Data Mozart has written a similar article using rule-based conditional formatting. If you are interested in this topic, be sure to read his article.
Why would you want to highlight data in Power BI instead of filtering it?
Sometimes, filtering isn’t the best way to understand data. Imagine you’re part of a sales team and want to compare your performance to your colleagues. Filtering would hide everyone else, leaving you with no context. Highlighting shows you where you are compared to everyone else very clearly while you still see the bigger picture. The same idea applies if you’re a manager analyzing customer segments. Highlighting adds an extra layer of clarity, letting you focus on specific data points while keeping the full context visible.
This approach works best with a manageable number of categories – around 5 to 10. If you have too many categories, the slicer and the visual can become cluttered, making it harder to guide the viewer and potentially overwhelming them.
Step 1: Set Up Your Slicers and Visuals
- Start by adding a basic slicer with your category data. For instance, to highlight sales by product category, create a slicer for “Category.”
- Add a bar chart visual. For our example, I used Category on the x-axis and Profit on the y-axis.
At this moment, clicking a category in the slicer filters the bar chart.
Step 2 & 3: Disable Filter Interaction & Create a Helper Table
- First, we want to disable the filter interaction from our slicer on the bar chart.
- Click on the slicer
- Go to Format (ribbon) and then “Edit interactions“.
- Set the interaction to “None.”
Nothing will happen in the visual when you click on a Category in the slicer.
- Next, create a helper table with the same categories as in the first table.
- Add the category in the new table to a new Slicer.
Step 4: Sync the Slicers
- Go to View > Sync Slicers > Advanced Options
- Group your original and new slicer together by assigning them to the same sync group (e.g., “Highlight”).
This ensures that selecting a category in one slicer syncs it with the other. You will see, when you click on a category in one of the slicers, this category will be selected in the other one, too.
Step 5: Create a DAX Measure to Count the Selected Categories
- Go to View > Sync Slicers > Advanced Options
- Group your original and new slicer together by assigning them to the same sync group (e.g., “Highlight”).
This ensures that selecting a category in one slicer syncs it with the other. You will see, when you click on a category in one of the slicers, this will also select it in the other.
In the next step we will use the result of this measure to format our bar chart.
Highlight Category =
VAR Category_Chosen =
// Count
COUNTROWS (
// Return categories that exist in both sets
INTERSECT (
VALUES ( Data[Category] ),
VALUES ( 'Highlight Category Table'[Category] )))
// Return the count of matching categories
RETURN
IF (
ISFILTERED ( 'Highlight Category Table'[Category] ), Category_Chosen,
0)
Step 6 & 7: Adding a Measure and Using a Field Value to Highlight Data in Power BI
- Next, we need to create a DAX measure that provides a color code for every category that is selected or not.
- After we have created that measure we can use the measure in conditional formatting of the bar chart.
- Click on the bar chart.
- Go to the format pane -> Bars -> Conditional formatting (fx)
- In the pop up choose: Format Style: Field Value & What field should we base this on: HEX Color Category Chosen
- Hide the original slicer. (View -> Selection – Hide (the eye symbol)
HEX Color Category Chosen =
IF ( [Highlight Category] = 1,
"#209aa6",
"#e6e6e6" )
// "#209aa6" = Teal "#e6e6e6" = gray (all categories that are not selected)
(Optional) Step 8: Dynamic Colors
If you want to change the color dynamically (instead of hardcoded in the DAX), you can set up a color table with predefined hex codes for each highlight color. This allows you to change highlight colors dynamically using another slicer. I’ve covered how to set up dynamic colors in another article & video, so check these out if you’re interested.
Final Thoughts - Highlight Data in Power BI
This method is a simple, effective way to visually compare categories without losing the overall context. It’s ideal for datasets with fewer categories, where highlighting offers clear guidance. However, too many options can quickly become overwhelming, as both the slicer and visual may clutter the experience.
Use it thoughtfully in performance comparisons or segment analysis scenarios for the best results.
Video: How to Highlight Data in Power BI with Slicers
To help you get a feel for the process, I followed each of these steps to highlight data in Power BI and recorded it.