Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Tell us which business and trade publications you read most regularly: RESPOND NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
selvakumara
Creator
Creator

Select Top 2 recent records for each client

Team,

I have a requirement to show two most recent  records for each client , I want to achieve using the expression. How can I do that?

The below Its displaying 4 records for Antonio.With that , I want to see only top 2 records 

selvakumara_0-1615966380974.png

 

Thanks

2 Replies
denisb
Contributor III
Contributor III

Maybe this can help: 

Tab:

LOAD * Inline [

Name , myDate

Antonio , '26.01.2021'

Antonio , '26.03.2021'

Antonio , '26.04.2021'

Antonio , '26.06.2021'

];


newTab:
NoConcatenate LOAD
Name
,max(myDate) as myDate
Resident
Tab
Group by Name;

Concatenate(newTab)
LOAD
Name
,max(myDate, 2) as myDate
Resident
Tab
Group by Name;

drop table Tab;

selvakumara
Creator
Creator
Author

I want to achieve in the set analysis