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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Nazeem81
Helper I
Helper I

Summarize column of datatype time

I have problems summarizing the values in a column (inloggad tid) showing time in format h:mm:ss, the total value is not coming correct.

 

I tried creating to new measures: 

Inloggad sum = MAXX(DISTINCT(Tiddata[ProjektDatumSäljare]);MAX(Tiddata[Inloggad tid]))

Inloggad tid sum = SUMX(DISTINCT(Tiddata[ProjektDatumSäljare]);[Inloggad sum])

 

I tried to use the new measure Inloggad tid sum but it s still not summarizing correctly. The measure Inloggad tid sum is of format Date Time.

 

When I tried this in Power Query in Excel it was working. When I created a pivot table and used the measure "Inloggad tid sum" I just changed the format of the values to [t]:mm:ss and the summary came correct.

 

How can this be solved in Power BI Desktop?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Nazeem81,

Create the following measures in your table.

totalseconds= SUMX('Tiddata',HOUR('Tiddata'[CopyDuration])*3600+MINUTE('Tiddata'[CopyDuration])*60+SECOND('Tiddata'[CopyDuration]))

 

Measure = RIGHT ( "0" & INT ( [totalseconds] / 3600 ), 2 )
& ":"
& RIGHT (
"0"
& INT ( ( [totalseconds] - INT ([totalseconds] / 3600 ) * 3600 ) / 60 ),
2
)
& ":"
& RIGHT ( "0" & MOD ([totalseconds] , 3600 ), 2 )



Regards,
Lydia

View solution in original post

5 REPLIES 5
Nazeem81
Helper I
Helper I

When I use code below the summary is showing correct value, for example 34days02:59:27. But I dont want to show the summary in days, I want to show total hours, minutes and seconds. Instead of  34days02:59:27 it should show 818:59:27

 

Anyone who can help me solve this?

 

newDuration =

VAR TotalSeconds=SUMX('Tiddata';HOUR('Tiddata'[CopyDuration])*3600+MINUTE('Tiddata'[CopyDuration])*60+SECOND('Tiddata'[CopyDuration]))

VAR Days =TRUNC(TotalSeconds/3600/24)

VAR Hors = TRUNC((TotalSeconds-Days*3600*24)/3600)

VAR Mins =TRUNC(MOD(TotalSeconds;3600)/60)

VAR Secs = MOD(TotalSeconds;60)

return IF(DAYS=0;"";IF(DAYS>1;DAYS&"days";Days&"day"))&IF(Hors<10;"0"&Hors;Hors)&":"&IF(Mins<10;"0"&Mins;Mins)&":"&IF(Secs<10;"0"&Secs;Secs)

Anonymous
Not applicable

@Nazeem81,

Create the following measures in your table.

totalseconds= SUMX('Tiddata',HOUR('Tiddata'[CopyDuration])*3600+MINUTE('Tiddata'[CopyDuration])*60+SECOND('Tiddata'[CopyDuration]))

 

Measure = RIGHT ( "0" & INT ( [totalseconds] / 3600 ), 2 )
& ":"
& RIGHT (
"0"
& INT ( ( [totalseconds] - INT ([totalseconds] / 3600 ) * 3600 ) / 60 ),
2
)
& ":"
& RIGHT ( "0" & MOD ([totalseconds] , 3600 ), 2 )



Regards,
Lydia

Nazeem81
Helper I
Helper I

Anyone, please?
Greg_Deckler
Community Champion
Community Champion

Can you share sample data so that I can try to recreate this?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi,

 

See link below dfor sample data. I Want to be able to summarize inloggad tid in Power BI deskptop. Picture below shows its not working for me to summarize when creating a new measure to be able to sum.

 

 

 

datatype time.PNGhttps://ufile.io/9rio2

 

 

 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.