Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Working with time duration

I am trying to put together a Power BI report that displays/totals/averages length of phone calls that are in hh:mm:ss format (e.g. 00:05:25 is a five minute and 25 second phone call). Struggling a l...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous 

     

    First, you need to convert the hh:mm:ss formatted strings to a total number of seconds to make them easier to sum and average.

    Seconds = 
    HOUR([Time]) * 3600 + 
    MINUTE([Time]) * 60 + 
    SECOND([Time])

     

    For display purposes, you might want to convert these aggregated durations back to a hh:mm:ss format. You can create a measure to do this. Here's how to convert the total talk time back to a readable format:

    TotalTalkTimeFormatted = 
    VAR Total = SUM('Table'[Seconds])
    RETURN
    FORMAT ( 
        DIVIDE(Total, 86400), 
        "hh:mm:ss"
    )

     

    This is the result you want

     

    Best Regards,

    Jayleny

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.