Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Selecting Top N Transactions from a transaction file

Hi, I have a transaction file containing cust_id and tran_amt columns, i want to pick top 3 transaction made by each cust_id. I have tried using tMap, tAggregated, but not able to get the correct results. can you suggest how do i achieve this.
Input Data
cust_id|tran_amt
1001|23
1001|24
1001|25
1004|67
1004|68
1004|69
1004|70
1004|71
1002|45
1002|46
1002|47
1002|48
1002|49
1003|55
1003|56
1003|57
1003|58
===============
Output Data
1001|25
1001|24
1001|23
1002|49
1002|48
1002|47
1003|58
1003|57
1003|56
1004|70
1004|69
1004|68
Regards
Sanjay
Labels (2)
2 Replies
alevy
Specialist
Specialist

Use tFilterRow with the advanced expression:
Numeric.sequence(input_row.cust_id,1,1)<4
Anonymous
Not applicable

Got it thanks Alevy...posted at 2 locations to get quick answers