Forum Discussion
Conditional Formatting Based on Measure using Slicer Selection Without Visual Interaction
Hello everyone,
I'm facing a challenge with setting up conditional formatting in a Power BI visual using a calculated measure. I’ve created a measure and applied it in the Field value section of the Data colors menu. It works correctly for two conditions:
- Highest value → Black
- Specific value (e.g., "X value " from 'All available Data'[Provider]) → Orange
Now, I want to add a third condition:
- If a provider is selected in a slicer, that provider’s column in the visual should be colored purple.
Here’s the setup:
- The slicer uses 'Provider Table'[Provider].
- The visual uses 'All available Data'[Provider].
- There is an active relationship between the two tables on the Provider column.
- I have disabled visual interaction between the slicer and the visual, so the chart always shows all providers regardless of slicer selection.
- The slicer is intended to act as a menu, allowing the user to highlight a specific provider in purple — without filtering the visual.
- Here is my DAX measure
However, the condition comparing SELECTEDVALUE('All available Data'[Provider]) to SELECTEDVALUE('Provider Table'[Provider]) does not seem to trigger the purple color as expected.
If I enable interactions on the slicer I am getting purple color only if one value is selected. If all or more I am getting same result as without having interactions enabled.
Has anyone successfully implemented this kind of logic? Any ideas on how to reference the slicer selection in a measure used for conditional formatting when the slicer does not filter the visual?
Thanks in advance!
Click here to download a solution from Onedrive
How it works ...
Create a detached picklist table
Create a measure
RAG = var mypicks = VALUES(picklist[Customers]) var mygraph = SELECTEDVALUE(yourdata[Customers]) RETURN IF(mygraph in mypicks, "Red")Add conditional formating to the column
Please click the thunbs up and the [accept solution button].
Many thanks!
6 Replies
- speedrampsSuper User
Click here to download a solution from Onedrive
How it works ...
Create a detached picklist table
Create a measure
RAG = var mypicks = VALUES(picklist[Customers]) var mygraph = SELECTEDVALUE(yourdata[Customers]) RETURN IF(mygraph in mypicks, "Red")Add conditional formating to the column
Please click the thunbs up and the [accept solution button].
Many thanks!
- v-tejramaCommunity Support
Hi mdm2025,
Has your issue been resolved?If the response provided by speedramps addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.If yes, kindly accept the useful reply as a solution and give us Kudos. It would be appreciated.
Thank you for your understanding!
- mdm2025Helper I
Hi speedramps ,
Thank you very much for providing the solution along with the example.
However after replicating the setup the conditional formating measure lists all values as red instead of only the selected one. I have tried disabling/enabling the interaction of the slicer with the visual but the color is the same for all selections (red).I have tried making an active relationship betwen the tables and inactivating it with the same result.
To elaborate my setup is the same as in your example:
The visual holds the dataset values
The slicer holds the picklist table.Any ideeas on what to double check?
Thanks again!- speedrampsSuper User
Hi again MDM
Sorry you are still having problems
Please click on the Onedrive link in my original answer. Check it works ok.
Once you proved to yourself that the solution works, then repeat my instructions more carefully.
Don't make changes (eg uses relationships).
Focus yourself on copying the instructions exactly. It will work.
- mdm2025Helper I
Hi speedramps ,
You are correct. Thank you againg for following up.
Not sure what I have changed but it works now 😄.
I have also update the DAX formula with additional conditions among which is having the blue default if no values from the slicer is selected( in case heplful for other community members in the future).
All the best!
- speedrampsSuper User
Hi again MDM
Glad that the problem has been solved.
Hope you learned something new about detached picklist and Dax.
Thanks, speedramps