Selecting Top N Transactions from a transaction file

One Star

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
Seven Stars

Re: Selecting Top N Transactions from a transaction file

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

Re: Selecting Top N Transactions from a transaction file

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

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads