Forum Discussion

PC2022's avatar
PC2022
Helper III
1 year ago
Solved

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?

 

ApproachingDate = IF
(( AND ( NOT ISBLANK (( [Expiration Date] )), DATEDIFF (TODAY (),crcc5_permitcoordination[Expiration Date], DAY ) = 30, "1", "0" ))
  • 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" )

5 Replies

    • PC2022's avatar
      PC2022
      Helper III

      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.

    • PC2022's avatar
      PC2022
      Helper III

      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

       

      • FreemanZ's avatar
        FreemanZ
        Super User

        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" )