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
fbittencourt
Advocate II
Advocate II

Color condition based on two variables

Hi all !!

 

I need to change the font color of  the column Nom du projet, based on two others columns Date derniere MEP Planifie and % Avancement projet

 Each one has already a color condition 

Format cond MEP-Jour font (Date derniere MEP Planifie) =
var MEP_Planifie = Max(REF_PROJET[MEP Date])
var colorchange =
SWITCH(
    TRUE(),
     MEP_Planifie < [Date_jourM-1], "#E66C37","#000000"
  
)
RETURN
colorchange
 
Format cond %avancement = IF(
    [% Avancement projet] > 0.9, "#e66c37","#000000")
 
if both are "red "the nom du projet must be " blue"
 
 Thanks for your help
 

 

 

 

fbittencourt_0-1738058609994.png

 

3 REPLIES 3
Bibiano_Geraldo
Super User
Super User

Hi @fbittencourt ,

Please adapt your DAX to look like this:

Format cond Nom du projet = 
VAR MEP_Planifie = MAX(REF_PROJET[MEP Date])
VAR Avancement = MAX(REF_PROJET[% Avancement projet])

-- Check the color conditions for Date derniere MEP Planifie
VAR Color_MEP = IF(MEP_Planifie < [Date_jourM-1], "#E66C37", "#000000")

-- Check the color conditions for % Avancement projet
VAR Color_Avancement = IF(Avancement > 0.9, "#E66C37", "#000000")

-- If both are red, set the color to blue, otherwise keep the respective color
RETURN 
    IF(Color_MEP = "#E66C37" && Color_Avancement = "#E66C37", "#0000FF", "#000000")
bhanu_gautam
Super User
Super User

@fbittencourt ,Create a new measure or column for the "Nom du projet" font color.

 

Format cond Nom du projet =
VAR MEP_Planifie = MAX(REF_PROJET[MEP Date])
VAR colorMEP = IF(MEP_Planifie < [Date_jourM-1], "#E66C37", "#000000")
VAR colorProgress = IF([% Avancement projet] > 0.9, "#E66C37", "#000000")
RETURN
SWITCH(
TRUE(),
colorMEP = "#E66C37" && colorProgress = "#E66C37", "#0000FF", // Both conditions are red, set to blue
colorMEP = "#E66C37", "#E66C37", // MEP condition is red
colorProgress = "#E66C37", "#E66C37", // Progress condition is red
"#000000" // Default color
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Thanks for your quick answer !! I will acceptt as a solution.

 

I have a small issue concerning blank values, if you are to hepl me again I appreciate, the condition applies as well with blank date values see below:




fbittencourt_0-1738060488947.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.