Forum Discussion
Convert to Time Format in the Power Query Editor in Power BI while importing the data from Excel
- 3 years ago
Hi mrk777 ,
I'd suggest to convert your duration column into seconds. With that you should be able to do all your calculations. You might wanna do something like the below:
And here the M code for the new column:
Number.FromText ( Text.BeforeDelimiter([duration],":") ) * 60 * 60 + Number.FromText ( Text.BetweenDelimiters([duration], ":", ":" ) ) * 60 + Number.FromText ( Text.AfterDelimiter([duration], ":", {0, RelativePosition.FromEnd}) )I used the example above in this blog post with a little bit more explanations:
https://www.tackytech.blog/how-to-swiftly-take-over-power-query/#11_Calculate_duration_from_time_columnLet me know if this helps ๐
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Hi mrk777 ,
I'd suggest to convert your duration column into seconds. With that you should be able to do all your calculations. You might wanna do something like the below:
And here the M code for the new column:
Number.FromText (
Text.BeforeDelimiter([duration],":")
) * 60 * 60
+ Number.FromText (
Text.BetweenDelimiters([duration], ":", ":" )
) * 60
+ Number.FromText (
Text.AfterDelimiter([duration], ":", {0, RelativePosition.FromEnd})
)
I used the example above in this blog post with a little bit more explanations:
https://www.tackytech.blog/how-to-swiftly-take-over-power-query/#11_Calculate_duration_from_time_column
Let me know if this helps ๐
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/