Forum Discussion

Nightwolf's avatar
Nightwolf
New Member
2 years ago

Handling Blank Measure Values in Matrix Table with Conditional Formatting Using SWITCH

Hello Power BI Community,

I'm currently working on a report in Power BI Desktop where I'm using a Matrix Table visual to display one measure.
My goal is to apply conditional formatting to this measures based on its value to enhance the report's readability and visual appeal. To achieve this, I've been exploring the use of the SWITCH() function in DAX to apply different colors based on specific conditions.

Here's a simplified version of what I'm trying to accomplish:

 

Measure Color = SWITCH(
TRUE(),
[MyMeasure] = 1, "Green",
[MyMeasure] < 1, "Yellow",
ISBLANK([MyMeasure]), "Red", // Intended to handle blank values
"Red"
)

 

I intend to use the Measure Color as the basis for conditional formatting on the field value in my Matrix table. The idea is to have the cells turn:

  • Green when the measure equals 1,
  • Yellow when it's less than 1,
  • And Red for blank values, or any other value.

While this setup works well for non-blank values, I'm encountering challenges when it comes to effectively handling and visually distinguishing the blank values in the Matrix. The conditional formatting doesn't seem to react as expected for the blanks.


My questions for the community is, is there a more effective way to apply conditional formatting using the SWITCH() function specifically for blank values in a measure within a Matrix table?


Thank you in advance for your time and assistance!

 

1 Reply

  • Nightwolf 


    Your measure is accurate. However, the empty spaces you're attempting to highlight are likely cells in your matrix where there's no data available for that specific row-column combination. Consequently, the conditional formatting measure can't evaluate those cells, which is why you're not seeing any effect from your conditional formatting. As far as I'm aware, there isn't a ready solution for this yet.