Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Average duration

Hello,

I want to get an average duration and change the format, any ideas ? i try many things put ended up with an issue...

I also would like to change the format so it is HH:mm:ss,

JRMBSO_0-1701179808052.png

Regards,

 

4 REPLIES 4
ppm1
Solution Sage
Solution Sage

Please see this article - Calculate and Format Durations in DAX – Hoosier BI

 

Pat

Microsoft Employee
ronrsnfld
Super User
Super User

Neither Power Query nor Power BI have a duration format where Hours can be 24 or higher.

So you would need to create a Text String to show that kind of result.

The text string would not be usable as is in future calculations.

Here is some sample code:

 

let
    Source = Table.FromColumns(
    {
        {#duration(0,0,26,4),
        #duration(0,0,25,26),
        #duration(0,0,33,42),
        #duration(0,0,34,2),
        #duration(0,2,17,10),
        #duration(0,2,16,47),
        #duration(0,17,29,50)}
    }, type table[Durations=duration]),
    

    avg = Duration.TotalHours(List.Average(Source[Durations])),
    hrs = Number.IntegerDivide(avg,1),
    tMin = Number.Mod(avg,hrs)*60,
    min = Number.IntegerDivide(tMin,1),
    sec = Number.Round(Number.Mod(tMin,min)*60,0),

    fmt = Number.ToText(hrs * 10000 + min * 100 + sec,"00:00:00")
    
in
    fmt

 

Result

03:26:09
AlienSx
Super User
Super User

Hello, @Anonymous try Time.From(Duration.TotalHours(List.Average(your_list)) / 24). But if Duration.TotalHours goes over 1 then you end up with error. 

Anonymous
Not applicable

Hello,

 

Well i did ended up with an error, but thanks for trying

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.