I have a data that has employeee id, employe name, duration. I am trying to calculate the total number of hours and minutes for each employee based on their IDs for example
EmpID | Emp Name | Duration (Minutes) |
---|---|---|
001 | Marc Jacobs | 30 |
001 | Marc Jacobs | 40 |
001 | Marc Jacobs | 80 |
002 | Bruce Wayne | 30 |
002 | Bruce Wayne | 25 |
003 | Brad Pitt | 40 |
003 | Brad Pitt | 40 |
003 | Brad Pitt | 80 |
I am trying to achieve this
EmpID | Emp Name | Duration (Minutes) | Total Hours |
---|---|---|---|
001 | Marc Jacobs | 30 | 2 hours 30 mins |
001 | Marc Jacobs | 40 | 2 hours 30 mins |
001 | Marc Jacobs | 80 | 2 hours 30 mins |
002 | Bruce Wayne | 30 | 55 mins |
002 | Bruce Wayne | 25 | 55 mins |
003 | Brad Pitt | 40 | 2 hours 40 mins |
003 | Brad Pitt | 40 | 2 hours 40 mins |
003 | Brad Pitt | 80 | 2 hours 40 mins |
you can try to create a column
Column=
VAR total =
CALCULATE (
SUM ( 'Table'[Duration (Minutes)] ),
ALLEXCEPT ( 'Table', 'Table'[EmpID] )
)
VAR h =
INT ( total / 60 )
VAR m =
MOD ( total, 60 )
RETURN
IF ( h <> 0, h & " hours " & m & " mins", m & " mins" )