Forum Discussion

mrbrabrook22's avatar
mrbrabrook22
New Member
3 years ago

How to convert text to duration without Error

Hi! I am attempting to display the sum of the duration passed (so the sum of this column) for various filters, and right now the field is reading as text in PowerBI.  The duration is written as days hours:minutes:seconds, is there anyway to convert to duration without getting an error and sum up the column. Additionally, there is an event stamp column I can use with the date and time the alarm started.

1 Reply

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Most Valuable Professional

    If you want to convert in a custom column

     

    Duration.FromText(Text.Replace([UnAckDuration]," ","."))

     

    If you want to sum the column and use it somewhere in your code (Replace Source with your previous step of the code)

     

    List.Sum(List.Transform(Source[UnAckDuration], (x)=>Duration.FromText(Text.Replace(x," ","."))))