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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MCacc
Helper III
Helper III

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
Impactful Individual
Impactful Individual

 

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.