March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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?
Solved! Go to Solution.
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
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!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
26 | |
14 | |
12 | |
11 | |
8 |
User | Count |
---|---|
41 | |
33 | |
29 | |
13 | |
13 |