Forum Discussion
time Tracking
- Anonymous3 years ago
Hi Piersj1994,
Any other fields exist in your table records that can be used to recognize the user status? Or these records are sorted based on the datetime values as sort order and odd/even number as group?(odd : sign in, even: sign out)
If that is the case, you can use these filed or try to add a new column to check records odd/even number based on current user id and datetime values to return the sign in/out status.
Status = VAR rowCount = COUNTROWS ( FILTER ( 'Table', [UserID] = EARLIER ( 'Table'[UserID] ) && [Datetime] <= EARLIER ( 'Table'[Datetime] ) ) ) RETURN IF ( MOD ( rowCount, 2 ) = 1, "In", "Out" )Then you can extract the hour part from the datetime values and calculate the duration include in current hour period.
If current 'In' and 'Out' status is in the same period, calculation should be the 'Out - In’.
For other scenario, calculation will be split to two parts. The ‘In’ part required to calculate the difference between 'In' to the 'end of current time period'. For the 'Out', you can calculate the difference between previous 'In’ record end period and the current 'Out'.
For 'Out' to 'In', these records should be excluded from calculations because user has out of the work.Regards,
Xiaoxin Sheng
I'm fairly new into this Power BI Application. I'm trying to use the Time that I have within this Query to make a visual that tracks coworkers and what time they are within the specific enviroment. to try and make a Time In and Time out that will showcase the hours they worked and any breaks in between. I'm just not sure where to start.
- Anonymous3 years agoNot applicable
Hi Piersj1994,
Any other fields exist in your table records that can be used to recognize the user status? Or these records are sorted based on the datetime values as sort order and odd/even number as group?(odd : sign in, even: sign out)
If that is the case, you can use these filed or try to add a new column to check records odd/even number based on current user id and datetime values to return the sign in/out status.
Status = VAR rowCount = COUNTROWS ( FILTER ( 'Table', [UserID] = EARLIER ( 'Table'[UserID] ) && [Datetime] <= EARLIER ( 'Table'[Datetime] ) ) ) RETURN IF ( MOD ( rowCount, 2 ) = 1, "In", "Out" )Then you can extract the hour part from the datetime values and calculate the duration include in current hour period.
If current 'In' and 'Out' status is in the same period, calculation should be the 'Out - In’.
For other scenario, calculation will be split to two parts. The ‘In’ part required to calculate the difference between 'In' to the 'end of current time period'. For the 'Out', you can calculate the difference between previous 'In’ record end period and the current 'Out'.
For 'Out' to 'In', these records should be excluded from calculations because user has out of the work.Regards,
Xiaoxin Sheng
- Piersj19943 years agoFrequent Visitor
I have the Log in and out status with the User, Also have the actual time of status and the hour column next to it.