Forum Discussion
Sum Of Duration
hi all
pretty new to power bi, and im struggling with handling duration, i want to be able to use the total duration of all rows as a sum value.
i can sum the total duration into seconds and have tried to aggregate the data vie the use of DAX
Do not add these as a column in your table. Make them measures only.
Then you add the measure to a visual next to the EvenName:
11 Replies
- jdbuchanan71Super User
Full Duration = VAR _Seconds = [Duration Seconds] VAR _Minutes = INT ( DIVIDE ( _Seconds, 60 ) ) VAR _RemainingSeconds = MOD ( _Seconds, 60 ) VAR _Hours = INT ( DIVIDE ( _Minutes, 60 ) ) VAR _RemainingMinutes = MOD ( _Minutes, 60 ) RETURN IF ( NOT ISBLANK ( [Duration Seconds] ), FORMAT ( _Hours, "00" ) & ":" & FORMAT ( _RemainingMinutes, "00" ) & ":" & FORMAT ( _RemainingSeconds, "00" ) )If you make this measure it will give you an output that looks like this:
- AnonymousNot applicable
thank you four your reply
this is what i get on the data tab, which is great, but as soon as i drag that column into the value on the graph, it still sets it as count, how can i set this to sum?
- jdbuchanan71Super User
Don't make it a calcualted column, make it just a measure. You will also need a measure that sums your 'Table'[Seconds].
Duration Seconds = SUM ( 'Table'[Seconds] )This is what goes into the firs VAR on the other measure.
- AnonymousNot applicable
jdbuchanan71 thank for your help,