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
PBandI
Frequent Visitor

Conditionally Formatting a Date Column

I am currently trying to format a date column based on if the date is in the past or if the date is blank. I am using a measure that I created for this and then passing it on to the conditional formatting for the column it should be applied to. If the date is in the past then the cell should be green, and if the date is blank then it should be red. The current measure I am using is shown below:

_HPA Status = IF(MAX('Opportunity'[HPA Signature Date]) < Today(), "Light Green" , "Light Red")

PBandI_2-1721165042568.png

 

The desired outcome is to have the cell that reads 12/27/2023 as green and all the other blank cells as red. Any help would be greatly appreciated!

 
 

 

 

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

Hi! 
The issue with your DAX measure is that any dates that are BLANK are actually evaluated as 0 (which is less than today in DAX logic), so it will always show green. To fix it, you can add another condition to check if the value is blank:

_HPA Status = IF(MAX('Opportunity'[HPA Signature Date]) < Today() && NOT(ISBLANK('Opportunity'[HPA Signature Date])), "Light Green" , "Light Red")

View solution in original post

1 REPLY 1
vicky_
Super User
Super User

Hi! 
The issue with your DAX measure is that any dates that are BLANK are actually evaluated as 0 (which is less than today in DAX logic), so it will always show green. To fix it, you can add another condition to check if the value is blank:

_HPA Status = IF(MAX('Opportunity'[HPA Signature Date]) < Today() && NOT(ISBLANK('Opportunity'[HPA Signature Date])), "Light Green" , "Light Red")

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.