Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
louise_atherton
Contributor III
Contributor III

How do I only get a table to display the last record completed using an expresssion?

Hello you clever people

 

I'm hoping someone can help me.  

 

I have a table and I want it to only display the last record not all 9 e.g. I only want to see the record for ID 5597221. Multiple of these can be added every month so I can't code the ID's in so not sure if there is a 'last' or 'max' function I can use that would give me what I need? 

louise_atherton_0-1632295491106.png

But I honestly can't figure out how to do it.  I only have a diluted version of Qlik so can't do any script uploads so have only the expression editor at my disposal. 

 

Thanks very much in advance of anyone who take the time to try and help.

 

Louise 

1 Reply
NitinK7
Specialist
Specialist

please try below code

First:
LOAD * INLINE [

Audit, question_group, date_completed, auditid
5, Fire, 9/3/2021 0:00, 5597221
5, Fire, 8/5/2021 0:00, 5488893
5, Fire, 7/8/2021 0:00, 5367138
5, Fire, 6/3/2021 0:00, 5250133
4, Fire, 5/6/2021 0:00, 5158629
4, Fire, 3/31/2021 0:00, 5066151
4, Fire, 3/1/2021 0:00, 4999015
4, Fire, 2/5/2021 0:00, 4938403
];

NoConcatenate
second:
load
*
Resident First
Order by date_completed asc;
drop Table First;

NoConcatenate

third:
load
*
Resident second where date_completed=Peek('date_completed',-1,'second');
drop Table second;

exit Script;

NitinK7_0-1632306684492.png