Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have two columns both in the following format
04/06/2020 05:02:00 so dd/mm/yyyy hh/mm/ss and I would like to subtract one from the other to get the duration in hrs - can anyone help please
Thankyou in advance
Solved! Go to Solution.
Use the Duration.TotalHours() function in Power Query. Just subtract column 1 from column 2. It will return total and fractional hours.
If you just need hours, round it using Number.Round(formula, 0)
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting@kenblack - If you need net work duration, you can use this: https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Duration-Working-Hours/m-p/481543#M...
@kenblack You can also do this in DAX with the DATEDIFF function https://docs.microsoft.com/en-us/dax/datediff-function-dax
Hours Difference = DATEDIFF([Start],[End],HOUR)
Respectfully,
Zoe Douglas (DataZoe)
Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/
Yes, if you need this in a measure, DATEDIFF() will work well. If you need a column, Power Query is generally a better choice for performance than a calculated column. So depends on how you are using this.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingUse the Duration.TotalHours() function in Power Query. Just subtract column 1 from column 2. It will return total and fractional hours.
If you just need hours, round it using Number.Round(formula, 0)
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingAdvance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.