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
cyclist007
Responsive Resident
Responsive Resident

Conditional formatting not working for custom value = 0

Hi I am trying to implement simple conditional formatting for background color for a field 'Alerts' with the value ranging 0 to Max value (which could be 10 or 200 or any positive integer). The color should range from white (for value zero) to bright red (for max value) as seen below:

 

image.png

The issue is when there are absolutely no alerts (alerts = 0 for all rows, records hence max value = 0) ... the conditional formatting picks the max value color and shows the background color as red, while what was expected was white. 

 

 

image.png

 

Is there something being done wrong, or is it normal to pick the max value conditional formatting when max & min values are the same?

And any suggestions to better implement this?

 
 

 

2 ACCEPTED SOLUTIONS
v-juanli-msft
Community Support
Community Support

Hi @cyclist007

A workaround below:

creating a measure

adding conditional formatting

Measure 3 = IF(SUM('Table'[alerts])>0,SUM('Table'[alerts]),BLANK())

Capture1.JPGCapture2.JPG

Best regards
Maggie
Community Support Team _ Maggie Li
If this post helps, please consider Accepting it as the solution to help other members find it more quickly.

View solution in original post

Thanks @v-juanli-msft for the solution, but then I can't show the count value of '0'.

I'm using another solution for now – using 'Diverging' and then defining it as shown below. But I haven't fully checked if this would break for some reason.

image.png

View solution in original post

6 REPLIES 6
v-juanli-msft
Community Support
Community Support

Hi @cyclist007

A workaround below:

creating a measure

adding conditional formatting

Measure 3 = IF(SUM('Table'[alerts])>0,SUM('Table'[alerts]),BLANK())

Capture1.JPGCapture2.JPG

Best regards
Maggie
Community Support Team _ Maggie Li
If this post helps, please consider Accepting it as the solution to help other members find it more quickly.

Thanks @v-juanli-msft for the solution, but then I can't show the count value of '0'.

I'm using another solution for now – using 'Diverging' and then defining it as shown below. But I haven't fully checked if this would break for some reason.

image.png

Hi @cyclist007 

but then i cannot show the count value of '0'.

I don't understand your problem here.

Can you create measure as i shown above?

 

Best Regards

Maggie

 

@v-juanli-msft Yes I did create the measure but ended up using it as field value also - my bad. Your solution works if i use the measure for conditional formatting only, Thanks!

 

Greg_Deckler
Community Champion
Community Champion

Perhaps enter a Highest Value of 1 or something like that?

 



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...


@Greg_Deckler wrote:

Perhaps enter a Highest Value of 1 or something like that?


That would not allow for agradient background color  ... maybe 1 alert is not as bad as 10 so i would like to show the gradient which is determined by the max value. 

 

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.