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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
PC2022
Helper I
Helper I

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.