Hi there, my client asked for a Clock In/Out feature which i created. Each one of those buttons records the user, the type (clock in or clock out) and the timestamp of when it was clicked. Now, the client wants to be able to create a weekly timesheet report for each user by clicking on an action. Iโve setup the Weekly Timesheet slice but iโ'm having trouble figuring out the expression for calculating the time each user has spent working throughout the week. How can I retrieve the Clock In/Out pairs so that i can subtract the Clock out from the Clock In time & then sum that up to get the total?
Thanks in advance!
Solved! Go to Solution.
Create a Virtual Column which will eventually calculate the durations for each of the clock-in&out records of each user:
CALCULATE DURATIONS Duration Type i.e. [Duration]
[Clock-Out] - [Clock-In]
CALCULATE TOTAL HOURS Decimal Type
TOTALHOURS(
SUM(
SELECT(
TableName[Duration],
[UserID] = [_THISROW].[UserID]
)
)
)
Make necessary changes to adopt the actual table & column names of your schema.
User | Count |
---|---|
17 | |
14 | |
8 | |
7 | |
4 |