Forum Discussion
Dunner2020
6 years agoPost Prodigy
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 =...
- 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
mahoneypat
6 years agoMicrosoft Employee
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