Forum Discussion

xoptopus's avatar
xoptopus
Regular Visitor
1 year ago
Solved

PowerBI time graphic

Hi,

I have two questions. First; I calculate a period based on the start (BASSAAT field name) and end (BITSAAT field name) times in my table. (With the SURE field name) I add these periods at the end. However, when the total hours are more than 24 hours, the total operation does not occur. How can I do this without using different methods? Second; I want to create a chart showing my total hours. I want to show the hour totals for different areas separately in a pie chart. How can I do this? Note: I would be very happy if you could do the operations in a sample file.

Thank you.

 

 

  • xoptopus's avatar
    xoptopus
    1 year ago

    Hi rajendraongole1 

    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?

2 Replies

  • 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."

     

     

    • xoptopus's avatar
      xoptopus
      Regular Visitor

      Hi rajendraongole1 

      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?