Forum Discussion
Conditional Formatting Dax
- 1 year ago
Hi kapildua16 Another way is through a measure you could also try if you want
Create a DAX Measure: Define a measure that assigns a numeric category (1–5) based on the value in the matrix.
PercentileCategory = VAR CurrentValue = SELECTEDVALUE(MatrixTable[Value]) -- Replace with your column name RETURN SWITCH( TRUE(), CurrentValue < 27, 1, -- 0-20% CurrentValue <= 37.4, 2, -- 21-40% CurrentValue <= 52, 3, -- 41-60% CurrentValue <= 95.2, 4, -- 61-80% TRUE(), 5 -- 81-100% )Apply Conditional Formatting:
- Go to your matrix visual, select the field you want to format, and navigate to Conditional Formatting > Background Color.
- Choose Format by: Field Value.
- Select the PercentileCategory measure.
- Assign colors to categories:
- Category 1 (0–20%): Light color.
- Category 2 (21–40%): Slightly darker shade.
- Category 3 (41–60%): Medium color.
- Category 4 (61–80%): Darker color.
- Category 5 (81–100%): Bright or bold color.
- Anonymous1 year ago
Hi, kapildua16
I wish you all the best. Previously MattiaFratello and Akash_Varuna have provided a solution to help you solve the problem. Since we haven't heard back from you yet, I'd like to confirm if you've successfully resolved this issue or if you need further help?
If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. If you find a reply particularly helpful to you, you can also mark it as a solution.
If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
Thank you for your patience and look forward to hearing from you.Best Regards
Jianpeng Li
Hi kapildua16 Another way is through a measure you could also try if you want
Create a DAX Measure: Define a measure that assigns a numeric category (1–5) based on the value in the matrix.
PercentileCategory = VAR CurrentValue = SELECTEDVALUE(MatrixTable[Value]) -- Replace with your column name RETURN SWITCH( TRUE(), CurrentValue < 27, 1, -- 0-20% CurrentValue <= 37.4, 2, -- 21-40% CurrentValue <= 52, 3, -- 41-60% CurrentValue <= 95.2, 4, -- 61-80% TRUE(), 5 -- 81-100% )Apply Conditional Formatting:
- Go to your matrix visual, select the field you want to format, and navigate to Conditional Formatting > Background Color.
- Choose Format by: Field Value.
- Select the PercentileCategory measure.
- Assign colors to categories:
- Category 1 (0–20%): Light color.
- Category 2 (21–40%): Slightly darker shade.
- Category 3 (41–60%): Medium color.
- Category 4 (61–80%): Darker color.
- Category 5 (81–100%): Bright or bold color.