Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MCacc
Helper IV
Helper IV

Color formatting based on switch measure

Hello, 

 

is it possible to use color formatting of values of only one measure inside a switch measure?

 

I have this measure which switches the calculation based on my rows values in a matrix table:

var index = SELECTEDVALUE(Dummy_Dimension_Row[ROW ID])

SWITCH(index,

1, [Measure 1], 

2, [Measure 2])

 

I need to color only the values in measure 1 and it is based on the values of the measure itself..

 

Measure 1 is :

 

max(TABLE_FACTS[DESCRIPTION])

 

Measure 2 is:

 

SUM(TABLE_FACTS[VALUE])

 

I already try this measure: 

SWITCH(TRUE(), 

[switch measure] = "High", "Red", 

[switch measure] = "Low", "Green")

 

But it doesn't work. 

 

Any other idea?

2 REPLIES 2
AnalyticPulse
Super User
Super User

 

If you want to apply conditional formatting to the values of Measure 1 in a matrix table based on their own values, you can create a measure that calculates the color for each cell. You can then use this measure for conditional formatting.

Here's an example of how you might achieve this:

 

Color Measure = VAR Index = SELECTEDVALUE(Dummy_Dimension_Row[ROW ID]) VAR Measure1Value = [Measure 1] RETURN SWITCH( Index, 1, IF(Measure1Value > 100, "Red", "Green"), 2, "Blue", -- Adjust conditions for Measure 2 as needed "Black" -- Default color if no condition is met )

In this example, the Color Measure calculates the color based on the conditions you specify for Measure 1. You can adjust the conditions inside the SWITCH function to match your specific requirements.

After creating this measure, you can use it for conditional formatting in the matrix table. Set up the conditional formatting rules based on the values returned by the Color Measure.
Give a thumbs up if this is helpful and shoot a sub on YouTube for future updates:
https://www.youtube.com/@AnalyticPulse

Ok thank you so much for your suggestion. 

 

I have one question though, 

 

measure 1 is used to color the values for 5 values of index row, 

 

How can I use multiple values of my index inside the switch?

 

Can I use somethig like

SWITCH(index_row

 IN {1,2,3,4,5}, IF(measure_1 = "High", "Red", IF(measure_1 = "Low", "Green"...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.