Forum Discussion
Summing time values in a table
Hi all,
I am relatively new to Power BI and need help with the following:
I have a dataset in Excel that shows me why a machine was malfunctioning. For each malfunction, I have the reason for malfunctioning ("Reason), a starting time ("Van"), and an ending time ("Tot"). Based on those times, I calculate the duration in Excel as "Tot" minus "Van". The duration is of data type "time" (hh:mm:ss). See also the screenshot below.
I would like to produce a visual that aggregates the total malfunction time for each "Reason" (as in a PivotTable in Excel). In other words, for above screenshot, the resulting table would need to show this:
However, when I try to do that with a table visual in Power BI, this is what I get as a result. Does anyone know how to resolve this?
Thanks in advance!
Hi, Anonymous
You need to create a measure to replace you original column field as below:
Measure_Duration = SUM('Table'[Duration])Then change the format of measure as below:
Best Regards,
Community Support Team _ Eason
3 Replies
- v-easonf-msftCommunity Support
Hi, Anonymous
You need to create a measure to replace you original column field as below:
Measure_Duration = SUM('Table'[Duration])Then change the format of measure as below:
Best Regards,
Community Support Team _ Eason- AnonymousNot applicable
Thanks a lot for your solution, I managed to fix it with your help!
- Greg_DecklerCommunity Champion
Anonymous You will need to convert those durations to seconds, add them and essentially convert them back more or less. Look at the links below, they should get you what you need.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639#M389
https://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486
https://community.powerbi.com/t5/Quick-Measures-Gallery/Duration-to-Seconds-Converter/m-p/342279#M92