cancel
Showing results for
Did you mean:

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

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.

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.

1 ACCEPTED SOLUTION
Super User

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:

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

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

Proud to be a Super User!!

8 REPLIES 8
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",
"red"
)``````

Super User

Hi @Kirt1965 ,

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

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

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

Proud to be a Super User!!

Super User

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

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Helper III

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

Super User

Hi @Kirt1965 ,

• 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:

Thanks,

Pragati

Best Regards,

Pragati Jain

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

Proud to be a Super User!!

Helper III

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.

Super User

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:

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

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

Proud to be a Super User!!

Helper III

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.

Announcements

#### New forum boards available in Real-Time Intelligence.

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

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors