Forum Discussion
Time format export data from hours to decimal
- 6 years ago
In query editor. Select the column and split it by deliminator
You get two columns. 1 is hours, 1 is mins
New column = hours + (mins/60) = decimal number and works with values over 24 hours.
KISS
Pmorg73 , sorry about that! Here's the link:
https://docs.microsoft.com/en-us/powerquery-m/duration-functions
What are you looking to calculate from that column? Do you need an integer column with the total number of minutes? A decimal column with the total number of hours (with the minutes portion making up the decimal amount)?
Whatever you do, don't create a calculated column in DAX on top of what you're building in M...that will bloat the model.
Let me know how you need the final column formatted, and sample calculations done with that column, and I'll help you write the M.
Cheers,
~ Chris
Pmorg73 , I reread your initial post.
Try this:
Duration.TotalHours( Duration.From( [Time Column] ) )
That should make 1 hr 45 min return as 1.75
- Pmorg736 years agoPost Patron
I dont know where to put that string?
crossing threads a bit but back to your earlier post.
What I actually want is a column that has up until now been in decimal hours. so 2.5 hours etc.
i think it would still work as hh:mm. But I am getting lost when I have done what you said. My column is now a duration in power query. When I close the editor the first entry is 11 hours and my table value is 0.45
So that looks to be in a day format. How do I change this. Note I am using a roll back to Dec version as Febs is no good for csv imports
- Pmorg736 years agoPost Patron
playing further in query editor
I made it a duration as discussed. I just went to transform and clicked on make sum of hours.......returns a decimal value of each row that at first glance looks correct......this might be my solution. will just interogate
- Pmorg736 years agoPost Patron
no its incorrect values. not the solution. 109hours output turned in to 13.3 hours so its miles off