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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
PC2022
Helper III
Helper III

And, DateDiff

I need to determine which Expiration Date is 30 days out and highlight it. I was trying to write the formula below and then use "1", "0" in the conditional formatting. My formula doesn't work. Can anyone help please?
PC2022_0-1730752526543.png

 

ApproachingDate = IF
(( AND ( NOT ISBLANK (( [Expiration Date] )), DATEDIFF (TODAY (),crcc5_permitcoordination[Expiration Date], DAY ) = 30, "1", "0" ))
1 ACCEPTED SOLUTION

hi @PC2022 ,

 

depending on your business logic, you need to change it to:

ApproachingDate = IF

 ( NOT ISBLANK (( crcc5_permitcoordination[Expiration Date] )) && DATEDIFF (TODAY (),crcc5_permitcoordination[Expiration Date], DAY ) >=30, "red" )

View solution in original post

5 REPLIES 5
FreemanZ
Super User
Super User

hi @PC2022 ,

 

try to apply the following measure as the conditional background color to  [Expiration Date] field of your visual:

ApproachingDate = IF

( AND ( NOT ISBLANK (( [Expiration Date] )), DATEDIFF (TODAY (),crcc5_permitcoordination[Expiration Date], DAY ) = 30, "red" )

 

like this:

IMG_20241105_051437.jpg

https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-conditional-table-formatting

I changed DAX and it gave me no errors:

ApproachingDate = IF
 ( NOT ISBLANK (( crcc5_permitcoordination[Expiration Date] )) || DATEDIFF (TODAY (),crcc5_permitcoordination[Expiration Date], DAY ) = 180, "red" )
 
But when i applied conditional formatting it highlighted all rows except for blanks
PC2022_0-1730814757782.png

 

hi @PC2022 ,

 

depending on your business logic, you need to change it to:

ApproachingDate = IF

 ( NOT ISBLANK (( crcc5_permitcoordination[Expiration Date] )) && DATEDIFF (TODAY (),crcc5_permitcoordination[Expiration Date], DAY ) >=30, "red" )

I added one more && and it worked! Thank you!

DAX didn't work, gave this error: too many arguements were passed to the AND function, The max argument count for the function is 2.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.