Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Find the row with most number of matches

Sshasnk
8 - Asteroid

I have a dataset where I have to match columns 

prdcodecyyprd_1code_1cyy_1
123AllUSD123ABCUSD
123AllAll123ABCUSD
456AKUINR456AKUINR
456AllAll456AKUINR
456AKUINR456AKUINR
789AllPND789GRRPND
789GRRPND789GRRPND
900LNORUS900LNORUS

 

Conditions:

1. We have to find the row which has the most number of matches for every prod 

2. As you can see prd and prd_1 will always be the same: We have to match these columns (code to code_1 and ccy to ccy1)

3. Now if you will see 1st line, code contains All and code_1 contains ABC both did not match, but ccy contains USD and ccy_1 is also contains USD, So we have the most number of the match in the 1st line for that prd. if you will see 2nd line which has the same prd 123 but ccy does not match with ccy_1 or code matches with code to code_1

 

prdcodecyyprd_1code_1cyy_1
123AllUSD123ABCUSD
456AKUINR456AKUINR
456AKUINR456AKUINR
789GRRPND789GRRPND
900LNORUS900LNORUS
1 REPLY 1
Luke_C
17 - Castor
17 - Castor

@Sshasnk 

 

Here's an approach that works with the data you provided, however if in practice you have many more columns to compare there's probably a way to make this more dynamic. 

 

Luke_C_0-1616612834032.png

 

 

Labels
Top Solution Authors