Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Sum duration?

Hello,

I have a Excel: 

I want to Sum those durations in Power BI. It should return Hours and Minutes like 12:35h. How can I realize this? What format should I use in Excel? I managed to sum those durations up with a measure but it returns a text value, so it is impossible to make eg. a bar chart. The measure is: 

Zeitaufwand=

VAR TotalSeconds=SUMX('Zeitaufwand Bewirtungen',HOUR('Zeitaufwand Bewirtungen'[Zeitaufwand Delegation/Gruppen])*3600+MINUTE('Zeitaufwand Bewirtungen'[Zeitaufwand Delegation/Gruppen])*60+SECOND('Zeitaufwand Bewirtungen'[Zeitaufwand Delegation/Gruppen]))
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)

3 Replies