Forum Discussion
Conditional Formatting based on Quartile % against score
- 9 months ago
Anonymous , Try like
Quartile % Measure =
VAR score = SELECTEDVALUE('Ranks Normalised'[GM_TOTAL_BRAG])
RETURN
SWITCH(
TRUE(),
score <= 0.25, "#F3747E",
score <= .5, "#F2EC4B",
score <=.75, "#CCFFA0",
"#A0D1FF"
)
You can use same in conditional formatting with the field value option - 9 months ago
Hi Anonymous,
Your current measure always returns #F3747E because the first condition score >= 0.25 is always true for any value above 0.25. As a result, the SWITCH function stops evaluating further conditions and returns the first match.Please, try it:
Quartile Colour = VAR score = SELECTEDVALUE('Ranks Normalised'[GM_TOTAL_BRAG]) RETURN SWITCH( TRUE(), score <= 0.25, "#F3747E", -- 1st quartile score <= 0.5, "#F2EC4B", -- 2nd quartile score <= 0.75, "#CCFFA0", -- 3rd quartile "#A0D1FF" -- 4th quartile )If this response was helpful in any way, I’d gladly accept a 👍much like the joy of seeing a DAX measure work first time without needing another FILTER.
Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop 🌀.
- 9 months ago
Hi Anonymous
You need to normalise the score first to achieve this. You have a couple of options
Option 1:
Normalise the score
Quartile % Measure = VAR score = SELECTEDVALUE('Ranks Normalised'[GM_TOTAL_BRAG]) / 100 RETURN SWITCH( TRUE(), score <= 0.25, "#F3747E", // Bottom quartile score <= 0.50, "#F2EC4B", // Second quartile score <= 0.75, "#CCFFA0", // Third quartile "#A0D1FF" // Top quartile )Option 2:
Use actual quartile values
Quartile % Measure = VAR score = SELECTEDVALUE('Ranks Normalised'[GM_TOTAL_BRAG]) VAR Q1 = PERCENTILEX.INC(ALL('Ranks Normalised'), [GM_TOTAL_BRAG], 0.25) VAR Q2 = PERCENTILEX.INC(ALL('Ranks Normalised'), [GM_TOTAL_BRAG], 0.50) VAR Q3 = PERCENTILEX.INC(ALL('Ranks Normalised'), [GM_TOTAL_BRAG], 0.75) RETURN SWITCH( TRUE(), score <= Q1, "#F3747E", score <= Q2, "#F2EC4B", score <= Q3, "#CCFFA0", "#A0D1FF" )--------------------------------
I hope this helps, please give kudos and mark as solved if it does!
Connect with me on LinkedIn.
Subscribe to my YouTube channel for Fabric/Power Platform related content!
- 9 months ago
Hi Anonymous
Calculate the maximum score for the Area and then apply the quartile logic based on that maximum instead of the individual house score
Quartile Conditional Format Colour Area = VAR AreaMaxScore = CALCULATE( MAX('Ranks Normalised'[BDM_ALL_RET_RANK_IN_LVL2]), ALLEXCEPT('Ranks Normalised', 'Ranks Normalised'[Area]) ) VAR Q1 = PERCENTILEX.INC(ALL('Ranks Normalised'), [BDM_ALL_RET_RANK_IN_LVL2], 0.25) VAR Q2 = PERCENTILEX.INC(ALL('Ranks Normalised'), [BDM_ALL_RET_RANK_IN_LVL2], 0.50) VAR Q3 = PERCENTILEX.INC(ALL('Ranks Normalised'), [BDM_ALL_RET_RANK_IN_LVL2], 0.75) RETURN SWITCH( TRUE(), AreaMaxScore <= Q1, "#FAC9CD", // Red AreaMaxScore <= Q2, "#F7F5B6", // Yellow AreaMaxScore <= Q3, "#E6FAD6", // Green "#DBEDFD" // Blue )--------------------------------
I hope this helps, please give kudos and mark as solved if it does!
Connect with me on LinkedIn.
Subscribe to my YouTube channel for Fabric/Power Platform related content!
Anonymous , Try like
Quartile % Measure =
VAR score = SELECTEDVALUE('Ranks Normalised'[GM_TOTAL_BRAG])
RETURN
SWITCH(
TRUE(),
score <= 0.25, "#F3747E",
score <= .5, "#F2EC4B",
score <=.75, "#CCFFA0",
"#A0D1FF"
)
You can use same in conditional formatting with the field value option