Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

Help please - Using peek - Calculate time difference from above record

Hello Everyone,

I'm trying to create a field with time difference between runners from the above  -

Group by Tournament, Sorted by Completion time.

First perosn who has completed will get 'First COmplete' Test.

Please see attached application.

Below is my data set and highlighted is my expected output.

 

TournamentRunnerCompleted

Diff in Hours compared to previous one

(Excepted field for output)

XYZK2/1/2018 10:31First complete
XYZL2/1/2018 13:01

2.4975 hrs

XYZM2/1/2018 13:010 hrs
ABCA1/15/2018 13:02First complete
ABCD1/15/2018 13:020 hrs
ABCB1/25/2018 23:02250 hrs

Any help is highly appreciated!!!

Message was edited by: Mark Graham

1 Solution

Accepted Solutions
sunny_talwar

Not sure, but something like this

Table1:

LOAD * INLINE [

    Tournament, Runner, Completed

    XYZ, A, 1/5/2018 13:02

    XYZ, B, 1/5/2018 13:02

    XYZ, C, 1/5/2018 13:02

    XYZ, D, 1/5/2018 13:02

    XYZ, E, 1/7/2018 6:16

    XYZ, F, 1/13/2018 3:30

    XYZ, G, 1/16/2018 9:31

    XYZ, H, 1/16/2018 14:46

    XYZ, I, 1/20/2018 6:47

    XYZ, J, 1/22/2018 13:31

    XYZ, K, 2/1/2018 10:31

    XYZ, L, 2/1/2018 13:01

    XYZ, M, 2/1/2018 13:01

    ABC, A, 1/15/2018 13:02

    ABC, B, 1/25/2018 23:02

    ABC, C, 1/10/2018 13:02

    ABC, D, 1/15/2018 13:02

    ABC, E, 1/7/2018 6:16

];


FinalTable:

LOAD *,

If(Tournament = Previous(Tournament), Completed - Previous(Completed), 0) * 24 as Difference

Resident Table1

Order By Tournament, Completed;


DROP Table Table1;

View solution in original post

6 Replies
markgraham123
Specialist
Specialist
Author

stalwar1‌ Can you please help?

sunny_talwar

Something like this?

Capture.PNG

markgraham123
Specialist
Specialist
Author

Sunny -

I wanted to do that in script.

markgraham123
Specialist
Specialist
Author

Sunny -

Please see updated application and output.

Thanks!

sunny_talwar

Not sure, but something like this

Table1:

LOAD * INLINE [

    Tournament, Runner, Completed

    XYZ, A, 1/5/2018 13:02

    XYZ, B, 1/5/2018 13:02

    XYZ, C, 1/5/2018 13:02

    XYZ, D, 1/5/2018 13:02

    XYZ, E, 1/7/2018 6:16

    XYZ, F, 1/13/2018 3:30

    XYZ, G, 1/16/2018 9:31

    XYZ, H, 1/16/2018 14:46

    XYZ, I, 1/20/2018 6:47

    XYZ, J, 1/22/2018 13:31

    XYZ, K, 2/1/2018 10:31

    XYZ, L, 2/1/2018 13:01

    XYZ, M, 2/1/2018 13:01

    ABC, A, 1/15/2018 13:02

    ABC, B, 1/25/2018 23:02

    ABC, C, 1/10/2018 13:02

    ABC, D, 1/15/2018 13:02

    ABC, E, 1/7/2018 6:16

];


FinalTable:

LOAD *,

If(Tournament = Previous(Tournament), Completed - Previous(Completed), 0) * 24 as Difference

Resident Table1

Order By Tournament, Completed;


DROP Table Table1;

markgraham123
Specialist
Specialist
Author

Thank you very much !!