Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
boyddt_mn
Helper III
Helper III

hightlight slicer if used

Is it possible to change the background color of a slicer if it is used? I have had complaints that my reports are showing incorrect data and the culprit is that the user have used slicers and didn't realize the impact. I have a button that will reset them but I would like to give an indication that the data is being filtered.

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @boyddt_mn 

 

According to the replies above and my testing, it seems a slicer's conditional formatting cannot apply to itself when users select various options on it.

 

So as a workaround, you could insert a rectangle and format its background conditionally with a measure like below. Then put the slicer on the top of the rectangle and group them. At last, turn off the slicer's background. 

 

M_color = IF(ISFILTERED(Tbl_Project[Project]),"#dddddd","#ffffff")

 

Now the rectangle's background will change when user has made options on the slicer. It looks like the slicer's background is changed.

122901.gif

Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

10 REPLIES 10
bradbahab_mi
New Member

Amazing workaround, thank you for this. This still works in June 2023. 
I used the measure in the conditional formatting property of the shapes Fill Style.
I made sure as well to remove the Backgroud option in General > Effects.

bradbahab_mi_0-1686948001942.png

bradbahab_mi_2-1686948140004.png

 

bradbahab_mi_1-1686948104026.png

 

 

ThomasDay
Impactful Individual
Impactful Individual

@v-jingzhang  Thank you for the workaround suggestion.
That said, what a shame the ISFILTERED() function doesn't work.  While the workaround kind-of works (it highlights the whole rectangle of the slicer...and that's pretty clumsy sometimes) you now clutter up your reports with objects and lose flexibility (highlight fonts, parts of the slicer) and make changes more difficult.  I did use the workaround, so that's something, anyway.
Tom

Hi @ThomasDay 

 

A slicer cannot filter itself so ISFILTERED() wouldn't work on it. If you want to highlight parts of the slicer, you could try a custom visual Hierarchical Filter / Slicer - xViz. It supports more advanced conditional formattings. See all of its features at xViz Hierarchy Filter/Slicer- Power BI Advanced Custom Visual

 

Regards,

Jing

@v-jingzhang Well, we're not talking about the slicer functionality itself, but the color of the container to the slicer.  The color is accessing a formula outside of the slicer (it would seem)...and applying what it learns to the container.  I even tried formulas where I used ALL() to get the unfiltered Min and Max values of a column and compare to the "current" Min...and no cigar.  While ISFILTERED clearly does not work in a slicer nor any formulas which clear context, the issue of being unable to set the color of the slicer container based on what the slicer has done seems like a design question rather than "it can't".

Thank you for the suggestion to look at the heirarchal slicer by xViz.  I need a slider style slicer (numeric range).  I'll check further to see if that's a style xViz supports.

Tom

v-jingzhang
Community Support
Community Support

Hi @boyddt_mn 

 

According to the replies above and my testing, it seems a slicer's conditional formatting cannot apply to itself when users select various options on it.

 

So as a workaround, you could insert a rectangle and format its background conditionally with a measure like below. Then put the slicer on the top of the rectangle and group them. At last, turn off the slicer's background. 

 

M_color = IF(ISFILTERED(Tbl_Project[Project]),"#dddddd","#ffffff")

 

Now the rectangle's background will change when user has made options on the slicer. It looks like the slicer's background is changed.

122901.gif

Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

Jing, thank you for the walkthrough. It was the Selection / Grouping that made the difference. Things are working great.

I was playing with that yesterday but I couldn't get the slicer to stay on top of the rectangle. I'll play with it again to see what I can get to work. Thank you for the video.

 

lbendlin
Super User
Super User

yes, the background color of the slicer visual supports functions

 

lbendlin_0-1608661484854.png

you can create a measure that uses ISFILTERED or COUNT(FILTERS()) or similar to switch this color based on the user selections. 

az38
Community Champion
Community Champion

@lbendlin not sure. it doesnt work for me. and I think the problem is not in measure, it returns correct result. could you try by yourself?


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

You are correct. I tried it too and none of the rules work. It does react to manual settings.  I would call this a bug.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.