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
Kirt1965
Helper III
Helper III

How to dynamically set min & max values for custom color in gauge?

Hello all,

 

I am trying to make a gauge color change from say red to green as the value goes up.  The problem is I am forced to hard code minimum and maximum values when defining the colors to use.  See the first image below.

What I see.PNG

 

Microsoft documentation implies I should be able to give it a color for the minimum value in a column and maximum as seen below.  How do I get these choices, because hard coding a maximum is not ideal.  That value will change over time.  Thank you.

What Microsoft Says.PNG

 

1 ACCEPTED SOLUTION

Hi @Kirt1965 ,

 

The reason for not getting this option is because you are using the GAUGE visual.

The article you are referring to works on other visuals like table chart, bar chart, etc. not on Gauge visual.

 

If you need information on custom colors in gauge, refer the following article for this:

https://radacad.com/sentiment-colors-for-gauge-visual-in-power-bi

 

You will have to I think create a DAX expression for the custom colors you are looking for and then use it on your gauge.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

@Kirt1965 , I doubt you can do that on color scale.

 

 

You can create a color measure and use that with "Field Value" Option

Color  = if(FIRSTNONBLANK(Table[Year],2014) <=2016 && AVERAGE(Sales[Sales Amount])<170 
,"lightgreen",if(FIRSTNONBLANK(Table[Year],2014)>2018,"red","yellow"))
Color sales = if([Sales Today] -[sales yesterday]>0,"green","red")

color =
switch ( true(),
FIRSTNONBLANK(Table[commodity],"NA") ="commodity1" && sum(Table[Value]) >500,"lightgreen",
FIRSTNONBLANK(Table[commodity],"NA") ="commodity2" && sum(Table[Value]) >1000,"lightgreen",
// Add more conditions
"red"
)

 

 

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

 

Pragati11
Super User
Super User

Hi @Kirt1965 ,

 

You need to select the FIELD VALUE option while setting up colors for gauge visual. see below:

Pragati11_0-1599150476941.png

 

Under BASED ON THE FIELD section, select your column or measure on the basis of which you want to chnage the color.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Greg_Deckler
Super User
Super User

@Kirt1965 - Are you using rules or a color scale?


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

I am trying to use color scale exactly as the documentation shows at https://docs.microsoft.com/en-us/power-bi/visuals/service-tips-and-tricks-for-color-formatting

 

Capture.PNG

Hi @Kirt1965 ,

 

This article tells 2 ways of doing things.

  • Using CUSTOM option
  • DEFAULT option

If you are using CUSTOM option, then you have to give a manual value; for which you have shared the screesnhot.

 

You can chnage this CUSTOM option to DEFAULT option by using the dropdown:

Pragati11_1-1599151923924.png

 

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

The problem is it does not let me choose anything but custom.  That is my only choice.  Custom is all I get and I have to hard code numbers.

Hi @Kirt1965 ,

 

The reason for not getting this option is because you are using the GAUGE visual.

The article you are referring to works on other visuals like table chart, bar chart, etc. not on Gauge visual.

 

If you need information on custom colors in gauge, refer the following article for this:

https://radacad.com/sentiment-colors-for-gauge-visual-in-power-bi

 

You will have to I think create a DAX expression for the custom colors you are looking for and then use it on your gauge.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Thank you.  Basically confirms what I suspected - that the gauge visual doesn't work the same as some others when it comes to custom colors.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.