Forum Discussion

Brazen_BI's avatar
Brazen_BI
Frequent Visitor
2 years ago
Solved

Convert Text (x Hours, xMinutes, xSeconds) to duration

Attempted unsuccessfully to convert text from column labeled "Handled Duration" into duration type with format "00:00:00". Purpose is to eventually use this column to calcuate total and average handl...
  • slorin's avatar
    2 years ago

    Hi, Brazen_BI 

     

    =Time.From(
    Text.Combine(
    List.Transform(
    Text.Split([Handled Duration],", "),
    each Text.BeforeDelimiter(_," ")),
    ":")
    )

    or

    #time(
    Number.From(Text.BeforeDelimiter([Handled Duration]," Hours")),
    Number.From(Text.BetweenDelimiters([Handled Duration],"Hours, "," Min")),
    Number.From(Text.BetweenDelimiters([Handled Duration],"Minutes, "," Sec")))

     

    Stéphane