The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Is it possible calculate the difference in days between two dates only when the difference is positive? In instances where the difference is negative it should return a 0 . Below would be the expected output.
Create Date | Request Date | Date Diff |
1/1/2024 | 1/9/2024 | 8 |
1/5/2024 | 1/10/2024 | 5 |
1/10/2024 | 1/11/2024 | 1 |
1/21/2024 | 1/12/2024 | 0 |
Solved! Go to Solution.
I used the following dax to create a calculated column with your desired results:
Date Diff =
var diff = DATEDIFF('Table'[Create Date], 'Table'[Request Date], DAY)
return IF(diff < 0 , 0, diff)
I used the following dax to create a calculated column with your desired results:
Date Diff =
var diff = DATEDIFF('Table'[Create Date], 'Table'[Request Date], DAY)
return IF(diff < 0 , 0, diff)