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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
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.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.