All,
I am trying to create the duration (Time difference) per user log in/out.
Table with my data
date_time | action | Name |
3/27/2023 8:54 | Checking In | Ahmed Mohamed |
3/28/2023 8:28 | Checking In | Ahmed Mohamed |
3/27/2023 12:36 | Checking Out | Ahmed Mohamed |
3/28/2023 12:58 | Checking Out | Ahmed Mohamed |
3/27/2023 9:49 | Checking In | Andres Edmundo Espinosa Gutierrez |
3/28/2023 8:27 | Checking In | Andres Edmundo Espinosa Gutierrez |
3/27/2023 16:15 | Checking Out | Andres Edmundo Espinosa Gutierrez |
3/28/2023 7:50 | Checking In | Anthony Baraja |
3/28/2023 16:53 | Checking Out | Anthony Baraja |
3/27/2023 8:00 | Checking In | Carlos Cabrera |
3/28/2023 7:59 | Checking In | Carlos Cabrera |
3/28/2023 17:07 | Checking Out | Carlos Cabrera |
3/27/2023 8:02 | Checking In | Carlos Mendoza |
3/28/2023 8:03 | Checking In | Carlos Mendoza |
3/27/2023 19:12 | Checking Out | Carlos Mendoza |
3/28/2023 20:12 | Checking Out | Carlos Mendoza |
3/27/2023 17:10 | Checking Out | Carlos Cabrera |
3/27/2023 8:00 | Checking In | Christopher Tamayo Cazarez |
3/28/2023 7:59 | Checking In | Christopher Tamayo Cazarez |
3/27/2023 17:10 | Checking Out | Christopher Tamayo Cazarez |
3/28/2023 17:07 | Checking Out | Christopher Tamayo Cazarez |
3/27/2023 10:04 | Checking In | Clovis Mepon Kamgang |
3/27/2023 16:00 | Checking Out | Clovis Mepon Kamgang |
3/28/2023 11:12 | Checking In | Clovis Mepon Kamgangkamgang |
3/28/2023 14:07 | Checking Out | Clovis Mepon Kamgangkamgang |
3/27/2023 8:54 | Checking In | Dameion Dismuke |
3/28/2023 8:28 | Checking In | Dameion Dismuke |
3/27/2023 17:38 | Checking Out | Dameion Dismuke |
Based on information found on this website
Measure =
var current_user=LASTNONBLANK('Daily Check in_out','Daily Check in_out'[Name])
var current_date=MAX('Daily Check in_out'[date_time])
var current_state=LASTNONBLANK('Daily Check in_out','Daily Check in_out'[action])
var min_date=switch(current_state,"Checking In",current_date,"Checking Out",maxx(FILTER(ALL('Daily Check in_out'),'Daily Check in_out'[Name]=current_user&&'Daily Check in_out'[date_time]<current_date),'Daily Check in_out'[date_time]))
var max_date=switch(current_state,"Checking In",minx(FILTER(ALL('Daily Check in_out'),'Daily Check in_out'[Name]=current_user&&'Daily Check in_out'[date_time]>current_date),'Daily Check in_out'[date_time]),"checking Out",current_date)
return
DATEDIFF(min_date,max_date,HOUR)
But I receive an error:
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
Anyone with a direction where I go wrong with this?
Solved! Go to Solution.
Never mind I know what I did wrong.
I was using date_time but i should use my timestamp column
Never mind I know what I did wrong.
I was using date_time but i should use my timestamp column
User | Count |
---|---|
122 | |
60 | |
60 | |
52 | |
40 |
User | Count |
---|---|
115 | |
64 | |
59 | |
54 | |
48 |