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!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
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
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 61 | |
| 58 | |
| 42 | |
| 18 | |
| 15 |
| User | Count |
|---|---|
| 105 | |
| 99 | |
| 38 | |
| 29 | |
| 29 |