Forum Discussion

gssarathkumar's avatar
1 year ago
Solved

Convert Text in Duration Format

Hi,   I have the below Input table and I intend to get the Required Output column.     Kindly help me on this solution   amitchandak Greg_Deckler lbendlin DesktopOwl Goodlytics4U HelpMe ...
  • Ahmedx's avatar
    Ahmedx
    1 year ago

    Is this what you are looking for?

     

    [
    a = Text.Select([Input],{"0".."9","D","H","M","S"," "}),
        b= Text.Split(a," "),
        d = Number.From(try b{List.PositionOf(b,"D")-1} otherwise 0),
        h = Number.From(try b{List.PositionOf(b,"H")-1} otherwise 0),
        m = Number.From(try b{List.PositionOf(b,"M")-1} otherwise 0),
        s= Number.From(try b{List.PositionOf(b,"S")-1} otherwise 0),
        final = #duration(d,h,m,s)][final]