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! Learn more
Hi All,
I have these two-time columns and I want to calculate the total hour's difference In the new custom column.
I took the difference but values are coming in minus. pls, help me to fix this.
i also need to take the difference of hours spent- required hours (9.6). could u tell me how to do this?
my table name here is timesheet.
Solved! Go to Solution.
@raimon thanks for the help. It's working fine. could you tell me what changes I have to make to get the output like this 9.6, 10.12, 10.30 as hours difference, currently I am getting a whole number.
Hi , @RAKESH1986
You can try to use this M code:
Duration.Hours([Time Out]-[Time in])+ Duration.Minutes([Time Out]-[Time in])/60
The result is as follows:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@raimon thanks for the help. It's working fine. could you tell me what changes I have to make to get the output like this 9.6, 10.12, 10.30 as hours difference, currently I am getting a whole number.
Hi , @RAKESH1986
You can try to use this M code:
Duration.Hours([Time Out]-[Time in])+ Duration.Minutes([Time Out]-[Time in])/60
The result is as follows:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @RAKESH1986,
while calculating the difference add this function which will convert it into hours -
Duration.Hours([Time Out]-[Time In])
See below for reference -
Advance 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.