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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
seanmcc
Helper I
Helper I

DAX conditional formatting

Hi all,
 
I am trying to create a measure for conditional formatting of background colour.
The conditional format is set up as the higher the better for most of my variables, however for four of my variables it should be the lower the better therefore the conditional formatting should be inverted.
 
Please see below the DAX I have so far;
 
Dynamic Background =

 

VAR red = "#e68f96"
VAR amber = "#ffd700"
VAR green = "#a4ff73"

 

VAR threshold = SWITCH(TRUE(),
VALUES('Readiness Unpivoted'[Test]) = "Sleep Quality", [Readiness Upper],
VALUES('Readiness Unpivoted'[Test]) = "Fatigue", [Readiness Upper],
VALUES('Readiness Unpivoted'[Test]) = "External Stress", [Readiness Upper],
VALUES('Readiness Unpivoted'[Test]) = "Muscle Soreness", [Readiness Upper],
[Readiness Lower])
 
VAR above = IF([Readiness Value] >= [Readiness AVG Selected], green)
VAR below = IF([Readiness Value] < threshold, red)
VAR between = IF([Readiness Value] <= [Readiness AVG Selected], IF([Readiness Value] >= threshold, amber))
 
I now need to invert the conditional format.
I hope this makes sense and thanks in advance.
 
Sean
2 REPLIES 2

You haven't provided ani info about the various  "readiness" measures, so it is hard to say. I suggest you investigate multiplying one of your measures by -1 to flip the biggest to smallest. It is hard to say where to do that given the info provided, but that is what I would be looking to do if it were me. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Thanks for your reply. Apologies if I was not clear.

However I did manage to figure it out by using SWITCH to change the calculation for the four 'Readiness Tests'.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors