Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Entry/Exit time difference report?

Hi guys,

I have an extract (attached) which contains all the access times (in and outs) to the building. Because the time data is in the same column (as opposed to having two columns: one for In and one for out), I am unable to calculate the differences/ time spent in the building.

Can any one suggest an approach to solving this? I have tried splitting the data out into separate tables and then joining in a variety of ways. Failed at all accounts. There has to be a simpler way of achieving this?

TimeAction
03/12/2012 07:51:08IN
03/12/2012 08:09:17OUT
03/12/2012 08:15:18IN
03/12/2012 14:10:05OUT
03/12/2012 16:11:09IN
03/12/2012 18:32:16OUT
04/12/2012 07:56:29IN
04/12/2012 11:03:20OUT
04/12/2012 11:08:44IN
04/12/2012 14:31:17OUT
04/12/2012 16:04:28IN
04/12/2012 18:09:42OUT
05/12/2012 08:00:37IN
05/12/2012 12:31:26OUT
05/12/2012 12:36:22IN
05/12/2012 16:26:12OUT
06/12/2012 08:00:09IN
06/12/2012 11:27:08OUT
06/12/2012 11:31:26IN
06/12/2012 14:28:31OUT
06/12/2012 16:19:42IN
06/12/2012 19:01:22OUT
07/12/2012 07:59:10IN
07/12/2012 12:42:33OUT
10/12/2012 08:01:20IN
10/12/2012 12:56:51OUT
10/12/2012 13:14:23IN
1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try something like

LOAD Time,

          Action,

          if( Action = 'OUT', interval(Time - peek('Time',-1) )) as TimeSpent

FROM ...;

View solution in original post

3 Replies
swuehl
MVP
MVP

Try something like

LOAD Time,

          Action,

          if( Action = 'OUT', interval(Time - peek('Time',-1) )) as TimeSpent

FROM ...;

er_mohit
Master II
Master II

in script

try this

interval((Time(Time,'hh:mm:ss')) -Previous(Time(Time,'hh:mm:ss')),'hh:mm:ss') as timediff

Not applicable
Author

Thank you! that works perfectly