Forum Discussion
Converting Decimal Hours to Time Format
jbolivar wrote:Hi
I have this case but in reverse. I need to convert a Time value to a Decimal value. In Excel I did not have any problems doing it because I took the "Tiempo Transcurrido (Time Lapsed)" field and multiplied it by 24.
I tried some functions (Time, Value) but I can not find the result. I have tried how to extract each of these values and then convert them into a number but I can not find a function that does it.
If I try to convert that column to Time format, it gives me an error
For me this value of Hour in decimal is very important for the calculations that I need to do.
I would greatly appreciate your help
Thank you
Friends,
I have solved this case using Power Query M function
=Number.FromText(Text.BeforeDelimiter([Tiempo transcurrido],":",0)) + (Number.FromText(Text.BetweenDelimiters([Tiempo transcurrido],":",":")))/60 + (Number.FromText(Text.AfterDelimiter([Tiempo transcurrido],":",1)))/3600.
Thank you
An alternative would be:
= List.Sum(
List.Transform(
List.Zip({
Text.Split(
[Tiempo transcurrido],
":"),
{1,60,3600}}),
each Number.From(_{0})/_{1})
)- jbolivar8 years agoFrequent Visitor
MarcelBeug wrote:An alternative would be:
= List.Sum( List.Transform( List.Zip({ Text.Split( [Tiempo transcurrido], ":"), {1,60,3600}}), each Number.From(_{0})/_{1}) )Excellent..it worked too
Thank you