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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Alvim102
New Member

How to averege a time conversion

Hello guys, I have a column called talking_time but in seconds, I did a conversion using the formula below:

 

Talking Time =
var T = SUM([talking_time])
var H = INT(T / 3600)
var M = INT((T - (H * 3600)) / 60)
var S = MOD(T, 60)
return
H * 10000 + M * 100 +  S

And then I have the result like this 12:55:15 for example, but when I use the averege formula on [Talking Time] I have the result like 05:89:25, the minutes are wrong, the correct one is up to 59 and after that it adds an hour.
 
How can I fix this?
1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Alvim102 

 

Talking Time =
VAR T =
    SUM ( 'Table'[talking_time] )
VAR H =
    FORMAT ( QUOTIENT ( T, 3600 ), "00" )
VAR M =
    FORMAT ( QUOTIENT ( MOD ( T, 3600 ), 60 ), "00" )
VAR S =
    FORMAT ( MOD ( MOD ( T, 3600 ), 60 ), "00" )
RETURN
    H & ":" & M & ":" & S

 

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @Alvim102 

 

Talking Time =
VAR T =
    SUM ( 'Table'[talking_time] )
VAR H =
    FORMAT ( QUOTIENT ( T, 3600 ), "00" )
VAR M =
    FORMAT ( QUOTIENT ( MOD ( T, 3600 ), 60 ), "00" )
VAR S =
    FORMAT ( MOD ( MOD ( T, 3600 ), 60 ), "00" )
RETURN
    H & ":" & M & ":" & S

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.