Forum Discussion
DAX - DateDiff not working correctly
- 1 year ago
Hello JohnYetsko
DATEDIFF('Plans-DR'[Expires], TODAY(), DAY)
This calculates the number of days from Expires to Today, which means:
If Expires = 07/03/2024 and Today = 04/30/2025, result = ~300 days
But if Expires = 07/04/2024, it's less than 300, so the IF logic flips
But ā your logic might be reversed depending on which way you're counting.
If you're checking how many days left until the expiry date, you should flip the arguments in DATEDIFF:
PlanCompliance =
IF (
ISBLANK('Plans-DR'[Expires]),
"No Plan Dates",
IF (
DATEDIFF(TODAY(), 'Plans-DR'[Expires], DAY) > 300,
"Non-Compliant",
"Compliant"
)
)
If this solved your issue, please mark it as the accepted solution. ā
Hi JohnYetsko
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.