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
Anonymous
Not applicable

Gauge Chart Colour Formatting From Measure

I'm trying to format a Gauge display so that the bar colour updates depending wether it is more than, equal to or less than a target that increases each week (ideally with margins either side). 

This is the measure i'm using to update the target each week. It's basically a set weekly target multiplied by the current week number.

 

 

*runningDtTargetAG = [*weeklyDtTargetAG]*WEEKNUM(TODAY())

 

 

 

This is the gauge. The gauge value is the sum of a field that is imported from an OEE system and is just a number value. I want to format the bar to be R/A/G based on the current target. Ideally yellow if it's +/- 5% of the target, red if it's +5% that and green if it's -5%.

TomWheater_0-1707659608954.png

 

I can't figure out how to get this to work form the 'Visual > Colours > Conditional Formatting' screen. I've tried the different options but I can't get it to use the running total number as a value in the boxes circled below:

 

TomWheater_1-1707659881272.png

TomWheater_2-1707659933710.png

 

Am I going about this the wrong way?

 

Thanks in advence,

Tom

 

 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Anonymous 
You nee the measure that returns the wanted color based on the value of the actual according to the target.
I made a small example to show how it works.
I didn't understand the "yellow" condition so it based 2 others.
The condition should be like :

color format = IF([act]>=[target_]*1.05,"red",
IF([act]<=[target_]*0.95,"blue"))
The measure could be with hex codes instead the words
after you have this measure you can take it to conditional formatting at the gauge:
Ritaf1983_0-1707709564225.png

result:

Ritaf1983_1-1707709592416.pngRitaf1983_2-1707709612079.png

I used blue instead of green because is not recommended in ux .
Colorblind people don't see the difference :
https://uxdesign.cc/from-a-colourblind-designer-to-the-world-please-stop-using-red-and-green-together-b311f321832c

pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

 

Thank you this worked perfectly. For the "yellow" part i managed it with an AND for the range of values.

*colourFormatTotal = SWITCH(
                        TRUE(),
                                [*minutesLost] <= [*runningDtTargetTotal]*0.95, "#2C9400",
                                [*minutesLost] >= [*runningDtTargetTotal]*1.05, "#C00000",
                                [*minutesLost] <= [*runningDtTargetTotal]*1.05 && [*minutesLost] >= [*runningDtTargetTotal]*0.95, "#E8CF55",
                        "null"
)

 

Ritaf1983
Super User
Super User

Hi @Anonymous 
You nee the measure that returns the wanted color based on the value of the actual according to the target.
I made a small example to show how it works.
I didn't understand the "yellow" condition so it based 2 others.
The condition should be like :

color format = IF([act]>=[target_]*1.05,"red",
IF([act]<=[target_]*0.95,"blue"))
The measure could be with hex codes instead the words
after you have this measure you can take it to conditional formatting at the gauge:
Ritaf1983_0-1707709564225.png

result:

Ritaf1983_1-1707709592416.pngRitaf1983_2-1707709612079.png

I used blue instead of green because is not recommended in ux .
Colorblind people don't see the difference :
https://uxdesign.cc/from-a-colourblind-designer-to-the-world-please-stop-using-red-and-green-together-b311f321832c

pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi!

 

I wrote  the dax but in the What field should we base this on? I am not able to select the measure. Do you know want can be the reason? Thanks so much for your help!!

bbnn_0-1725610037161.png

 

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.