Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone, I came across this task:
change the number of session in case user was inactive for more that 30 minutes.
Would appreciate any help
So I have the following input data on logs:
Time | Session | etc... |
---|---|---|
10:00:00 | 1 | |
10:05:00 | 1 | |
10:50:00 | 1 | |
11:00:00 | 1 | |
11:55:00 | 1 |
I want to check the difference between two consecutive timestamps and if the difference is greater that 30 min, I assume that user has ended previous session and started a new one, like:
Time | Session | etc... |
---|---|---|
10:00:00 | 1 | |
10:05:00 | 1 | |
10:50:00 | 1.1 | |
11:00:00 | 1.1 | |
11:55:00 | 1.2 |
I assume my code would look something like, but it obviously wouldn't work
Table:
load Time,
//Session,
if(Previous(Time) - Time > 30, Session+0.1, Session) as Session
Resident Table_tmp;
Would appreciate any help, thank you
Try this:
Table:
LOAD Time,
Session
FROM
[https://community.qlik.com/thread/237857]
(html, codepage is 1252, embedded labels, table is @1);
FinalTable:
LOAD *,
If(Time - Previous(Time) > MakeTime(0, 30), Peek('New_Session')+0.1, Alt(Peek('New_Session'), Session)) as New_Session
Resident Table
Order By Time;
DROP Table Table;
Try this:
Table:
LOAD Time,
Session
FROM
[https://community.qlik.com/thread/237857]
(html, codepage is 1252, embedded labels, table is @1);
FinalTable:
LOAD *,
If(Time - Previous(Time) > MakeTime(0, 30), Peek('New_Session')+0.1, Alt(Peek('New_Session'), Session)) as New_Session
Resident Table
Order By Time;
DROP Table Table;
That's actually amazing,
works just as needed
Thank you Sunny