Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Daz474
New Member

Time Conversion to Hours

A particular data base exports hours data incorrectly as a 'clock' value. For example, 1.5 hours would be exported as 1.3 hours, 1.25 hours as 1.15 hours etc. No idea why...but the 'minutes' value is from 1 - 60 instead of 1 - 100.

 

Anyway, I am trying to convert to decimal hours  and cannot get it to work. I have tried the following:

 

Split by decimal point and simply divide the miunutes value by 60. 

 

This does work in principal, however since the right value of the decimal split loses both the leading or ending 0 it doesn't work in those cases. 

 

For example, 1.30 will split into 1 hour and 3 minutes, as will 1.03

 

Can anyone think of a solution to this problem?

1 ACCEPTED SOLUTION
daXtreme
Solution Sage
Solution Sage

EVALUATE
var Val = 1.45 // 1 hour, 45 minutes
var Hours = int( Val )
var Minutes = ( Val - Hours ) * 100
var HourMinutesInDecimal = ( Hours * 60 + Minutes ) / 60
return
    { HourMinutesInDecimal } // output: 1.75

View solution in original post

2 REPLIES 2
daXtreme
Solution Sage
Solution Sage

EVALUATE
var Val = 1.45 // 1 hour, 45 minutes
var Hours = int( Val )
var Minutes = ( Val - Hours ) * 100
var HourMinutesInDecimal = ( Hours * 60 + Minutes ) / 60
return
    { HourMinutesInDecimal } // output: 1.75

Thanks for that, it really is a great solution. I got very close to thinking in that way also but you are so clear and efficeint compared to where i was at. Much appreciated!

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.