The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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