Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
ciaran_mcgowan
Partner - Creator III
Partner - Creator III

Display selected rows and the x number of rows that follow

Hi all,

I'm building an document that reads information from thousands of HTML files and loads them into Qlikview but I need to find a way to either (a) show the below using selectors or (b) load the data into the document described below.

The information that is loaded is the UserID, an InteractionID, their Score, the InteractionTime like this:

USERIDINTERACTIONIDSCORETIME
02111509:00
02121709:30
02131210:45
02141511:30
043178:30
0432199:45
04331710:15
04341412:30
04351113:50

What I need is to only display Scores >= 17 but I also need to be able to see the score that follows it, even if it's less than 17 (even if it's below 17). So the above table should be shown as:

USERIDINTERACTIONIDSCORETIME
02121709:30
02131210:45
0432199:45
04331710:15
04341412:30

I'm not sure if it's possible using selectors and I've had no luck doing it via the load script. Any suggestions would be greatly appreciated.

1 Solution

Accepted Solutions
MarcoWedel

Hi Ciaran,

to be more flexible with your limit value you could create one field containing the maximum value of the current and the previous score:

tabData:

LOAD

  USERID,

  INTERACTIONID,

  SCORE,

  if(SCORE>Previous(SCORE), SCORE, Previous(SCORE)) as SCORE_SELECTOR,

  TIME

FROM

[http://community.qlik.com/thread/109994]

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

QlikCommunity_Thread_109994_Pic1.JPG.jpg

QlikCommunity_Thread_109994_Pic2.JPG.jpg

hope this helps

regards

Marco

View solution in original post

4 Replies
swuehl
MVP
MVP

You can flag the records in your script like

INPUT:

LOAD USERID,

     INTERACTIONID,

     SCORE,

     TIME,

     if(SCORE>=17 or peek(SCORE)>=17, 1,0) as Flag

FROM

[http://community.qlik.com/thread/109994]

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

Then create a table box in your UI with USERID, INTERACTIONID, SCORE and TIME and select Flag = 1 in a list box to filter.

MarcoWedel

Hi Ciaran,

to be more flexible with your limit value you could create one field containing the maximum value of the current and the previous score:

tabData:

LOAD

  USERID,

  INTERACTIONID,

  SCORE,

  if(SCORE>Previous(SCORE), SCORE, Previous(SCORE)) as SCORE_SELECTOR,

  TIME

FROM

[http://community.qlik.com/thread/109994]

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

QlikCommunity_Thread_109994_Pic1.JPG.jpg

QlikCommunity_Thread_109994_Pic2.JPG.jpg

hope this helps

regards

Marco

srchilukoori
Specialist
Specialist

If you are trying to display the scores +/- 2 of what you have selected, this will help.

SC

ciaran_mcgowan
Partner - Creator III
Partner - Creator III
Author

Hi Marco,

That worked. Thank you so much for your help. I was wondering if you could help me out again though? I have been asked (on top of the original calculation) to only display the records that occur within 2 hours of each other. So now it would have to display all scores over 17 and the record that follows it, but only if the second record was taken within two hours.

Thanks.