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
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.