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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Time not adding up correctly in Total

Hi Team,

 

I have a measure "Project Aux" created as below and formated as hh:nn:ss.  However, this doesnt show accurate total for the hierarchy.  In the below picture, I need the total to be total hours/min/sec of the ones marked in yellow. 

 

How do I amend the below measure to get the right total? please help.

 

Project Aux =
Var PA = IFERROR((sum(ITOps_Telecom[Aux6])/60),0)
return TIME ( 0, 0, 0 )
+ DIVIDE ( PA, ( 24 * 60) )

 

 

LP28D_1-1633446359319.png

 

 

2 ACCEPTED SOLUTIONS

You've got some errors in your computations.

 

I'd suggest something similar to the post I linked:

Duration Formatted = 
VAR TotalDuration = SUM ( ITOps_Telecom[Aux6] )
VAR TotalHours = TRUNC ( 24 * TotalDuration )
VAR MinSec = FORMAT ( TotalDuration - TotalHours / 24, "nn:ss" )
RETURN
    TotalHours & ":" & MinSec

View solution in original post

Anonymous
Not applicable

@AlexisOlson I modified your solution and it worked.  My duration is in Seconds. So I divided  sum(itops_telecom[aux6) by 86400 which is 24*60*60.

 

thank you very much

 

Duration Formatted =
VAR TotalDuration = divide (SUM ( ITOps_Telecom[Aux6] ),24*60*60)
VAR TotalHours = TRUNC ( 24 * TotalDuration )
VAR MinSec = FORMAT ( TotalDuration - TotalHours / 24, "nn:ss" )
RETURN TotalHours & ":" & MinSec

View solution in original post

6 REPLIES 6
AlexisOlson
Super User
Super User

I don't think the time data type supports values greater than 24 hours, so you'll need to change this to return text values in the format you prefer.

 

See here for formatting suggestions: https://stackoverflow.com/questions/50388603

Anonymous
Not applicable

@AlexisOlson Thank you for the response. I did try the below.  but its not showing up the right value.

 

Sum of minutes formatted =
VAR sumOfMinutes =
divide (sum(ITOps_Telecom[Aux6]),(24*60))
VAR totalHours = sumOfMinutes / 60
var hours = int(sumOfMinutes)
var Mint = 60*(sumOfMinutes - hours)
var mins = int(Mint)
var secs = ROUND(60*(Mint-mins),0)
var res = hours & ":" & mins & ":" & secs
return res
 
LP28D_0-1633448600387.png

 

You've got some errors in your computations.

 

I'd suggest something similar to the post I linked:

Duration Formatted = 
VAR TotalDuration = SUM ( ITOps_Telecom[Aux6] )
VAR TotalHours = TRUNC ( 24 * TotalDuration )
VAR MinSec = FORMAT ( TotalDuration - TotalHours / 24, "nn:ss" )
RETURN
    TotalHours & ":" & MinSec
Anonymous
Not applicable

@AlexisOlson Thank you very much. I tried your solution. but it gives the values as below. 

 

LP28D_0-1633451013917.png

 

Anonymous
Not applicable

@AlexisOlson I modified your solution and it worked.  My duration is in Seconds. So I divided  sum(itops_telecom[aux6) by 86400 which is 24*60*60.

 

thank you very much

 

Duration Formatted =
VAR TotalDuration = divide (SUM ( ITOps_Telecom[Aux6] ),24*60*60)
VAR TotalHours = TRUNC ( 24 * TotalDuration )
VAR MinSec = FORMAT ( TotalDuration - TotalHours / 24, "nn:ss" )
RETURN TotalHours & ":" & MinSec

Great. That's exactly what I was going to suggest since my TotalDuration assumed units of days.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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