Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi All,
I want to get the difference between 2 dates, StartDate and EndDate columns. (format are date for both)
I am using the 'Add Custom Column' in Power Query.
=Number.RoundUp(([EndDate]-[StartDate])/365)
I get the error here stated we cannot convert the value #duration(2,0,0,0) to type number.
May I know what is the workaround?
Thank you.
Solved! Go to Solution.
The corrected formula In Power Query would be:
=Number.RoundUp(Duration.Days([EndDate]-[StartDate])/365)
Otherwise this would not be my prefered way to calculate years between dates.
The corrected formula In Power Query would be:
=Number.RoundUp(Duration.Days([EndDate]-[StartDate])/365)
Otherwise this would not be my prefered way to calculate years between dates.
Custom Column = DATEDIFF([End Date], [Start Date], DAY)
Make sure Start and end date are in Date/Time format and DAY should not be a function.
Thanks,
Himanshu
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |