Forum Discussion

Dunner2020's avatar
Dunner2020
Post Prodigy
6 years ago
Solved

Date difference when condition met

Hi there,    I am calculating the date difference between two columns with a condition that if Date A column has '1/01/1900' then do not take the difference. Here is my code:   Diff_in_days  =...
  • mahoneypat's avatar
    6 years ago

    Please try this expression

    Diff_in_days =
    VAR retail_notify =
        MAX ( 'Outages'[Date B] )
    VAR interuption_start =
        MAX ( 'Outages'[Date A] )
    RETURN
        IF (
            YEAR ( retail_notify ) > 1900,
            DATEDIFF ( interuption_start, retail_notify, DAY )
        )

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat