Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
smiling_cheetah
Creator
Creator

Calculate time spent on sheets

Hi everyone, quite in need of some help

[Usually I scout forums to find answers but this time couldn't] 

I'm trying to calculate time spent on each page of a document based on server logs and basically got files with the following structure:

UserTimeTypeSheetObjectSession
Tony10:40OpenSH10Document1
Tony10:50Activated SheetSH12Sheet1
Tony11:00Activated SheetSH15Sheet1
Tony11:20Activated SheetSH12Sheet1
Tony11:30Activated SheetSH10Sheet1
Tony11:50CloseSH10Document1

As an outcome I'm trying to get a table that looks like that:

UserSessionSheetTimeSpent
Tony1SH1000:30
Tony1SH1200:20
Tony1SH1500:20

I get that I need to go from the first record to second (and so on), count the difference between timestamps and attribute that difference to the first Sheet. But struggling to figure out how to wrap it in QV code.

Any help would be really appreciated

1 Solution

Accepted Solutions
sunny_talwar

This?

Capture.PNG

Script:

Table:

LOAD User,

    Time(Time#(Time, 'hh:mm'), 'hh:mm') as Time,

    Type,

    Sheet,

    Object,

    Session

FROM

[https://community.qlik.com/thread/230379]

(html, codepage is 1252, embedded labels, table is @1);

FinalTable:

LOAD *,

  Interval(If(User = Previous(User), Previous(Time) - Time, 0), 'hh:mm') as TimeSpent

Resident Table

Order By Time desc;

DROP Table Table;

View solution in original post

2 Replies
sunny_talwar

This?

Capture.PNG

Script:

Table:

LOAD User,

    Time(Time#(Time, 'hh:mm'), 'hh:mm') as Time,

    Type,

    Sheet,

    Object,

    Session

FROM

[https://community.qlik.com/thread/230379]

(html, codepage is 1252, embedded labels, table is @1);

FinalTable:

LOAD *,

  Interval(If(User = Previous(User), Previous(Time) - Time, 0), 'hh:mm') as TimeSpent

Resident Table

Order By Time desc;

DROP Table Table;

smiling_cheetah
Creator
Creator
Author

Thank you, that's just what i've needed