Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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:
Now, I want to add a third condition:
Here’s the setup:
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!
Solved! Go to Solution.
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!
Hi again MDM
Glad that the problem has been solved.
Hope you learned something new about detached picklist and Dax.
Thanks, speedramps
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!
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.
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!
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!
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!
User | Count |
---|---|
85 | |
82 | |
66 | |
53 | |
47 |
User | Count |
---|---|
101 | |
51 | |
41 | |
39 | |
38 |