Forum Discussion
akhan786
2 years agoFrequent Visitor
time difference (available and logout) state for different users
First column consists of date and time. Second column with users (A and Z), third column consists of the states (available and loggedout). I want to calculate the time difference between ...
- Anonymous2 years ago
Hi akhan786 ,
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:Create a column
Logout to Available Duration = VAR _a = CALCULATE( MIN('Table'[DateTime]), FILTER( 'Table', 'Table'[Status] = "Available" && 'Table'[DateTime] > EARLIER('Table'[DateTime]) ) ) VAR _b = IF( 'Table'[Status] = "Logout", [DateTime] ) RETURN IF( _b <> BLANK(), DATEDIFF(_b,_a,MINUTE) )Final output
Best regards,
Albert HeIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Anonymous
2 years agoNot applicable
Hi akhan786 ,
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:
Create a column
Logout to Available Duration =
VAR _a =
CALCULATE(
MIN('Table'[DateTime]),
FILTER(
'Table',
'Table'[Status] = "Available" && 'Table'[DateTime] > EARLIER('Table'[DateTime])
)
)
VAR _b =
IF(
'Table'[Status] = "Logout",
[DateTime]
)
RETURN
IF(
_b <> BLANK(),
DATEDIFF(_b,_a,MINUTE)
)
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly