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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.