Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

How to Split a Duration Column into Separate Columns for Days, Hours and Minutes?

  • Hi Anonymous 
    I have taken your sample data for example. please the follwing steps in PQ:
    1) duplicate 2 time same column 

    2) make sure its is in duration data type all 3 columns

    3)right click on column> Tarnsform > day

     

    4) then you will get only Days. do the same for hour and mints.

       5) after doing for hour and minus you will get the desired result.

     

    I hope i answered your question.



7 Replies

  • Uzi2019's avatar
    Uzi2019
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 
    I have taken your sample data for example. please the follwing steps in PQ:
    1) duplicate 2 time same column 

    2) make sure its is in duration data type all 3 columns

    3)right click on column> Tarnsform > day

     

    4) then you will get only Days. do the same for hour and mints.

       5) after doing for hour and minus you will get the desired result.

     

    I hope i answered your question.



    • Anonymous's avatar
      Anonymous
      Not applicable

      .

  • rsbin's avatar
    rsbin
    Icon for Community Champion rankCommunity Champion

    Anonymous ,

    Please try it this way.

    In your first step, split by Delimiter, but use a period ".", not the colon.
    That will give you Days, then a second column with the remainder. 

    Then split this column by Delimiter again, but use the Colon ":" this time.

    Then you can delete the Seconds column if it of no use in your Report.

    Trust this helps you on your way.

    Regards,

  • Anonymous  You can try using Splitter.SplitTextByAnyDelimiter  to split a column using multiple delimiter as shown below:

     

    = Table.SplitColumn(Source, "Duration",  Splitter.SplitTextByAnyDelimiter({".",":"}, QuoteStyle.Csv), {"Days", "Hours","Minutes"})

     

     

     

    Hope this answers your question...

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      .

      • AnthonyJoseph's avatar
        AnthonyJoseph
        Icon for Resolver III rankResolver III

        Hi Anonymous, might be because of the column name. Can you try renaming the column name to be "Duration" i.e. removing space and special characters.