I am working on a clocking in/out system, that keeps a log of every action. I was hoping to pull data from that log and display who is still clocked in using a slice. Here's how the log might look (data is not real):
Timestamp | Date | Time | Action | Name |
01/03/2022 08:49:07 | 01/03/2022 | 08:49:07 | Clock In | Dean Barnes |
01/03/2022 22:49:42 | 01/03/2022 | 22:49:42 | Clock Out | Dean Barnes |
02/03/2022 08:31:56 | 02/03/2022 | 08:31:56 | Clock In | Barry Mack |
02/03/2022 08:52:55 | 02/03/2022 | 08:52:55 | Clock In | Jenny Rose |
02/03/2022 09:32:16 | 02/03/2022 | 09:32:16 | Clock In | Dean Barnes |
02/03/2022 18:00:16 | 02/03/2022 | 18:00:16 | Clock Out | Barry Mack |
02/03/2022 18:16:01 | 02/03/2022 | 18:16:01 | Clock Out | Dean Barnes |
02/03/2022 18:18:56 | 02/03/2022 | 18:18:56 | Clock Out | Jenny Rose |
I can write an expression that correctly selects everyone that is clocked in on a specific date:
AND([Date] = TODAY(), [Action] = "Clock In")
But what I don't know how to do, is make sure the expression doesn't display a row where the same person has clocked out later.
Any help would be gratefully appreciated!
Solved! Go to Solution.
You want to add to your expression where the "person is not in the list of users who have clocked out". The expression would look like this:
AND([Date] = TODAY(),
[Action] = "Clock In",
NOT(IN([Name], SELECT(YourTableName[Name],
AND([Date] = TODAY(), [Action] = "Clock Out"))))
)
For what it's worth, the table you have is good for logging activity - i.e. what happened when in a chronological order - but it is not good for tracking people's status (did they clock out) nor is it good for calculating the hours, let alone the sum of hours, which is the whole reason for having a Timesheet app - easy automatic computation of the hours worked.
I would recommend to have a Timesheet table with both columns for In and Out on a single row. When a person Clocks In, create a row with the In time populated. Now you can easily find rows for each person who has not clocked out - Clock Out is blank. When they do clock out, you can calculate the hours right there in the row. Summing across the rows becomes easy!!!
You want to add to your expression where the "person is not in the list of users who have clocked out". The expression would look like this:
AND([Date] = TODAY(),
[Action] = "Clock In",
NOT(IN([Name], SELECT(YourTableName[Name],
AND([Date] = TODAY(), [Action] = "Clock Out"))))
)
For what it's worth, the table you have is good for logging activity - i.e. what happened when in a chronological order - but it is not good for tracking people's status (did they clock out) nor is it good for calculating the hours, let alone the sum of hours, which is the whole reason for having a Timesheet app - easy automatic computation of the hours worked.
I would recommend to have a Timesheet table with both columns for In and Out on a single row. When a person Clocks In, create a row with the In time populated. Now you can easily find rows for each person who has not clocked out - Clock Out is blank. When they do clock out, you can calculate the hours right there in the row. Summing across the rows becomes easy!!!
Two tables would be good for this operation. As WillowMobileSys stated having a table that just has the user click in and out on 1 row would be the best option for tracking who is currently clocked in and out. However, what you also are wanting to do is have a history of clock ins and outs. Therefore, having a second table that just contains the history is in order here. You need to create a bot to automate this though so that each entry also writes a new record to the 2nd table.
You're both absolutely correct, 'two sheets' was actually my first attempt, but I couldn't get the automation to update a different form.
Every time I attempted it, it would only allow me to make changes on the form it detected an update on and I couldn't get my head around how to make it take that data and add it to a separate log. Instead, I opted for this less streamlined approach because I could get it to mostly work.
@WillowMobileSys this works great, thank you. It's flawed but only thanks to my own poor understanding of how to make this work properly.
The app examples don't quite have the functionality I'm looking for. I don't want the user to clock out on a second screen, I was just looking for a Clock In/Clock Out button on one screen that would update depending on their current status.
User | Count |
---|---|
18 | |
11 | |
7 | |
3 | |
2 |