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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
TheDrDetroit
Regular Visitor

conditional formatting colors when comparing values

I'm formatting colums to change colors when compared to a planned value.  If it's lower it turns red, if it's higher it turns green.  DB_1.JPG

When the cells are empty the default to not being less that the planned value and are green.

Is there a way to default to white when no data is entered?  This is the DAX I'm using:

Color Mar = IF ( MAX ( 'KPI' [Mar-Actual]  ) < MAX ( 'KPI' [Mar-Plan] ) , "#BBF4C6", "#E68F96" )

1 ACCEPTED SOLUTION
TheDrDetroit
Regular Visitor

With the help of MageVortex this is the DAX that worked:

 

Color March = IF ( COUNT ( 'KPI' [Actual]  ) = BLANK(), "#FFFFFF", IF ( MAX ( 'KPI' [Actual] ) < MAX ( 'KPI' [Plan] ), "#E68F96", "#BBF4C6" ))

 

You have to use the hex code for the colors, I made the mistake of not entering a hashtag before the color code and it created an error.  Thanks for your help MageVortex.

View solution in original post

9 REPLIES 9
TheDrDetroit
Regular Visitor

With the help of MageVortex this is the DAX that worked:

 

Color March = IF ( COUNT ( 'KPI' [Actual]  ) = BLANK(), "#FFFFFF", IF ( MAX ( 'KPI' [Actual] ) < MAX ( 'KPI' [Plan] ), "#E68F96", "#BBF4C6" ))

 

You have to use the hex code for the colors, I made the mistake of not entering a hashtag before the color code and it created an error.  Thanks for your help MageVortex.

TheDrDetroit
Regular Visitor

Color mar = IF ( COUNT ( 'KPI' [Mar-Actual]  ) = BLANK(), "#FFFFFF", IF ( MAX ( 'KPI' [Mar-Actual] ) < MAX ( 'KPI' [Mar-Plan] ), "#BBF4C6" , "#E68F96"))

 

TheDrDetroit
Regular Visitor

I got it to work!!!

Please do tell us how you got it to work and mark it as an answer to future peep's can take advantage of your genius : )

MageVortex
Helper I
Helper I

Can you do a nested if?  

Nested Color Mar = IF (  'KPI' [Mar-Actual] = "000000",   IF ( MAX ( 'KPI' [Mar-Actual]  ) < MAX ( 'KPI' [Mar-Plan] ) , "#BBF4C6""#E68F96" )

Granted, 000000 may be the wrong value to use.  Just a thought, let me know if it fails 🙂

It's giving me an error message, it's asking to specify an aggregation, min, max, count, sum

 

Sorry, I forgot to finish the equation, it should have read more akin to:
 IF (  'KPI' [Mar-Actual] =BLANK(), "000000", IF (blahblahblah

Or perhaps a 

0

in place of 

BLANK()
 
That may not help the report I was testing with is my own and set up differently than yours.  If you must use min max or sum, you can just try sum = 0 or something like that. 
Hope that helps.

Thank you for your help!

I tried COUNT and SUM, they're not working, the error message says there are too many arguments for the funciton.  

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.