Forum Discussion
Help with a DAX Measure and Conditional Formatting
- Anonymous1 year ago
Hi Easter-J
Thanks for reaching out on the Microsoft Fabric Community Forum,
As vicky_ suggested, try using the MAX function instead of SELECTEDVALUE. This approach is more stable, especially when your matrix is aggregating values.
Here’s a revised version of your measure using MAX, with a green highlight as you requested.
Highlight Color =
VAR _id = SELECTEDVALUE('Voluntary 2s Removed'[Id])
VAR _rate = MAX('Voluntary 2s Removed'[Rate]) -- You can also use AVERAGE or MIN depending on your needs
RETURN
SWITCH(TRUE(),
_id = "8.1.12" && _rate >= 2.90, "#A9DFBF", -- Green_id = "1.1.2" && (_rate <= 3.50 || _rate >= 4.50), "#F9E79F", -- Yellow
"#FFFFFF" -- Default white)
If your matrix is aggregating values, replacing SELECTEDVALUE(Rate) with an aggregation like MAX(Rate) or AVERAGE(Rate) ensures more consistent and reliable conditional formatting.If this solution works for you, please consider marking it as accepted so others facing a similar issue can benefit too!
Let me know if you need help customizing the colors or logic further
Regards,
Akhil.
Hi Easter-J
Just wanted to check in, do you still need a hand with this? Sometimes these things take a few tries to get right, so if you're seeing anything new or different, feel free to share and I’ll gladly take another look. And if one of the replies helped solve it, feel free to mark it as a solution so others can find it too. A quick “Kudos” is always appreciated as well.
Thanks,
Akhil.
Thank you for checking back in! I was able to figure it out with a combination of both your suggestion and vicky_ feedback.
- Anonymous1 year agoNot applicable
Hi Easter-J
That's awesome to hear glad you got it working. Sounds like a great collaboration between our suggestions and vicky_ input. If you run into any issues in the future, feel free to reach out on the Microsoft Fabric Community forum, we're always happy to help.
And if a particular solution worked for you, don’t forget to mark it as accepted. It really helps others in the community too.
Regards,
Akhil.