Forum Discussion
PowerBI time graphic
- 1 year ago
Thank you for your valuable answer. The total time you gave in your example is 21 hours. My totals exceed 24 hours. Can you give an example about this? Also, how can I show these hours in a pie chart?
Hi xoptopus - Instead of using a time data type, calculate the total duration in minutes or seconds, then convert it to the desired format.You can create a measure to sum the durations in minutes and then display them in hours and minutes, even if they exceed 24 hours.
Total Hours =
VAR TotalMinutes = SUMX('Table', HOUR('Table'[SURE]) * 60 + MINUTE('Table'[SURE]))
VAR Hours = QUOTIENT(TotalMinutes, 60)
VAR Minutes = MOD(TotalMinutes, 60)
RETURN Hours & "h " & FORMAT(Minutes, "00") & "m"
Make sure you have an "Area" column in your table.Create a measure to calculate the total duration for each area
Total Duration by Area =
SUMX('Table', HOUR('Table'[SURE]) * 60 + MINUTE('Table'[SURE]))
Use the "Area" field for the "Legend."Use the "Total Duration by Area" measure for the "Values."
Thank you for your valuable answer. The total time you gave in your example is 21 hours. My totals exceed 24 hours. Can you give an example about this? Also, how can I show these hours in a pie chart?