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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ProverbialPaul
Regular Visitor

How to sum two durations stored in separate tables?

Hello everyone

 

I'm sure this is an easy one but it's tripping me up.

 

I have two tables, both containing start and finish times and a power query calculated colum to work out the duration:

 

ProverbialPaul_0-1654260232938.png

 

In each table, I have been using the following function to change the duration to an hour and min output:

 

Time taken =
VAR Elapsed_Time = SUM('Module Repairs'[Time taken - Duration])
VAR _hrs = (Elapsed_Time) * 24
VAR hrs = INT(_hrs)
VAR mins = ROUND((_hrs - hrs) * 60, 0)
RETURN
FORMAT(hrs,"00") & "h " & FORMAT(mins,"00") & "m "
 
ProverbialPaul_1-1654260338859.png

 

I now want to sum the durations from both tables, apply the same function, and output a Total Time field.
 
In my brain, I thought I could just do this:
 
Total duration =
VAR Total_Time = SUM('Module Repairs'[Time taken - Duration]+'Travel Time'[Total travel duration])
VAR _hrs = (Total_Time) * 24
VAR hrs = INT(_hrs)
VAR mins = ROUND((_hrs - hrs) * 60, 0)
RETURN
FORMAT(hrs,"00") & "h " & FORMAT(mins,"00") & "m "
 
But it doesn't work.
 
Would somebody be able to point me in the right direction please?
 
Thanks team!
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@ProverbialPaul 

Try adding them after summing each like this.

VAR Total_Time = SUM('Module Repairs'[Time taken - Duration]) + SUM('Travel Time'[Total travel duration])
VAR _hrs = (Total_Time) * 24
VAR hrs = INT(_hrs)
VAR mins = ROUND((_hrs - hrs) * 60, 0)
RETURN
FORMAT(hrs,"00") & "h " & FORMAT(mins,"00") & "m "

View solution in original post

2 REPLIES 2
ProverbialPaul
Regular Visitor

@jdbuchanan71 

 

Of course it would be 🤦‍

 

Thank you good sir. I appreciate your help.

jdbuchanan71
Super User
Super User

@ProverbialPaul 

Try adding them after summing each like this.

VAR Total_Time = SUM('Module Repairs'[Time taken - Duration]) + SUM('Travel Time'[Total travel duration])
VAR _hrs = (Total_Time) * 24
VAR hrs = INT(_hrs)
VAR mins = ROUND((_hrs - hrs) * 60, 0)
RETURN
FORMAT(hrs,"00") & "h " & FORMAT(mins,"00") & "m "

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors