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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Starbug
New Member

Query re: average time

Hello, I have a table named "Incidents" and a column named totalDuration_inSeconds, will the following when applied give me the average time of the total incidents? including when i apply extra filters such as region the incident was created?

 

Measure = FORMAT(AVERAGE(Incidents[totalDuration_inSeconds]),"HH:MM:SS")
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Starbug,

You can create one measure as below:

averageDuration = var ave=AVERAGE('Incidents'[totalDuration_inSeconds])
var h = if(LEN(INT(ave/3600))=1,CONCATENATE("0",INT(ave/3600)),CONCATENATE("",INT(ave/3600)))
var m = if(LEN(INT(MOD(ave,3600)/60))=1,CONCATENATE("0",INT(MOD(ave,3600)/60)),CONCATENATE("",INT(MOD(ave,3600)/60)))
var s = if(LEN(MOD(MOD(ave,3600),60))=1,CONCATENATE("0",left(MOD(MOD(ave,3600),60),2)),CONCATENATE("",left(MOD(MOD(ave,3600),60),2)))
var duration=CONCATENATE(h,CONCATENATE(":",CONCATENATE(m,CONCATENATE(":",s))))
return  duration

duration.JPG

Best Regards

Rena

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Starbug,

You can create one measure as below:

averageDuration = var ave=AVERAGE('Incidents'[totalDuration_inSeconds])
var h = if(LEN(INT(ave/3600))=1,CONCATENATE("0",INT(ave/3600)),CONCATENATE("",INT(ave/3600)))
var m = if(LEN(INT(MOD(ave,3600)/60))=1,CONCATENATE("0",INT(MOD(ave,3600)/60)),CONCATENATE("",INT(MOD(ave,3600)/60)))
var s = if(LEN(MOD(MOD(ave,3600),60))=1,CONCATENATE("0",left(MOD(MOD(ave,3600),60),2)),CONCATENATE("",left(MOD(MOD(ave,3600),60),2)))
var duration=CONCATENATE(h,CONCATENATE(":",CONCATENATE(m,CONCATENATE(":",s))))
return  duration

duration.JPG

Best Regards

Rena

TomMartens
Super User
Super User

Hey @Starbug ,

 

I guess this will provide what you are looking for:

https://community.powerbi.com/t5/Desktop/Average-duration-in-dd-hh-mm-ss/td-p/313661

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Starbug
New Member

Sorry just to add, the data appears like this if it helps at all; 

 

https://i.imgur.com/gwCqQ3v.png 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.