Forum Discussion
Anonymous
7 years agoNot applicable
Sum total time between timestamps from logging table
Hello I have two tables below, one with employees and one table with transactions where they start and stop their clock. I need to sum the total of hours between the start and stop for each loggi...
- 7 years ago
Hi Anonymous,
The solution of PattemManohar should be useful.
By my tests, you could create a calculated column with the formula below then you could get your desired output.
Hour = VAR a = CALCULATE ( MAX ( 'Timelog'[Timestamp] ), FILTER ( ALL ( 'Timelog' ), 'Timelog'[Timestamp] < EARLIER ( 'Timelog'[Timestamp] ) && 'Timelog'[EmployeeID] = EARLIER ( 'Timelog'[EmployeeID] ) && 'Timelog'[Activity] <> EARLIER ( 'Timelog'[Activity] ) && 'Timelog'[Activity] = "Start" ) ) RETURN DATEDIFF ( a, 'Timelog'[Timestamp], HOUR )Here is the output.
Best Regards,
Cherry
PattemManohar
Community Champion
7 years agoAnonymous I've recently posted a solution to same scenario, please have a look if that helps and post any questions...
https://community.powerbi.com/t5/Desktop/calculating-working-time-in-office/m-p/567548#M267842