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

Retrieve the last 5 records in a table

Dear Qlikview user

 

I was wondering if someone could kindly help me with a potential way forward 

I am using example data but the concept is real. I would like to retrieve the last 3 records for each patient in a  load script table i

Example:

Load

Patient Number     Date                       Test

123                               01/01/2020          1

123                               02/01/2020           1

123                               03/01/2020            1

123                                04/01/2020            1

123                                05/02/2020            1

From

Test

 

The records I would like to be returned are highlighted in bold.    Before I go down a rabbit warren of possibilities I.e. using the peek function, loop functions etc, I was wondering if there is a function built in which I could use to retrieve the last 3 records per patient 

If you have come across something similar in the past, a helpful hint would be gratefully appreciated

 

Kind Regards

Helen

 

 

 

 

 

3 Replies
alex00321
Creator II
Creator II

Hi try my attached solution to see if that works. Thanks!

helen_pip
Creator III
Creator III
Author

Thank you for taking the time to reply

 

We are testing it now and will get back to you as to whether the solution worked

 

kind Regards

Helen

 

 

Brett_Bleess
Former Employee
Former Employee

Helen, just a gentle reminder to not forget to return to your thread and close things out...  I am guessing the sample app likely worked, if so, please be sure to use the Accept as Solution button on that post to mark it as the solution, which will give credit to the poster for the help and let the other Members know it worked.  If you still need further help, please leave an update.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.