Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Tree Map Colour Formatting =
VAR NewZealand = IF(SELECTEDVALUE('Team Stats'[Team]) = "New Zealand", True, False)
VAR France = IF(SELECTEDVALUE('Team Stats'[Team]) = "France", True, False)
RETURN
SWITCH(
TRUE(),
NewZealand , "#000000",
France, "#0000C0")
Hi
I have the above DAX that will colour my chart appropriately when either New Zealand France are selected in the Country Slicer
But I want to colour the chart regardless of the slicer selection
Can anyone suggest an approach?
Solved! Go to Solution.
If you want to apply conditional formatting based on the team regardless of the slicer selection, you can modify your DAX code. Instead of relying on the SELECTEDVALUE function, you can directly compare the Team column with the desired team names. Here's an example:
Tree Map Colour Formatting =
VAR CurrentTeam = 'Team Stats'[Team]
RETURN
SWITCH(
TRUE(),
CurrentTeam = "New Zealand", "#000000",
CurrentTeam = "France", "#0000C0",
// Add more conditions as needed
"#FFFFFF" // Default color if none of the conditions are met
)
In this example, the CurrentTeam variable captures the currently selected team from the 'Team Stats' table. The SWITCH function then checks the value of CurrentTeam against the desired teams ("New Zealand", "France") and assigns the corresponding color. You can add more conditions as needed.
The last line with #FFFFFF is the default color in case none of the conditions are met.
This modification should apply the conditional formatting based on the team regardless of the slicer selection.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
If you want to apply conditional formatting based on the team regardless of the slicer selection, you can modify your DAX code. Instead of relying on the SELECTEDVALUE function, you can directly compare the Team column with the desired team names. Here's an example:
Tree Map Colour Formatting =
VAR CurrentTeam = 'Team Stats'[Team]
RETURN
SWITCH(
TRUE(),
CurrentTeam = "New Zealand", "#000000",
CurrentTeam = "France", "#0000C0",
// Add more conditions as needed
"#FFFFFF" // Default color if none of the conditions are met
)
In this example, the CurrentTeam variable captures the currently selected team from the 'Team Stats' table. The SWITCH function then checks the value of CurrentTeam against the desired teams ("New Zealand", "France") and assigns the corresponding color. You can add more conditions as needed.
The last line with #FFFFFF is the default color in case none of the conditions are met.
This modification should apply the conditional formatting based on the team regardless of the slicer selection.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.
User | Count |
---|---|
48 | |
44 | |
19 | |
14 | |
14 |
User | Count |
---|---|
107 | |
58 | |
29 | |
21 | |
16 |