Alteryx Designer Desktop Discussions

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

How to filter specific rows

jpscoralick
8 - Asteroid

Hello everyone!

Throughout my workflow I have to handle the following issue.
When I have more than one PERC% value for the same KEY (like 0,17 below for KEY DEX9), I have to filter each CODE with an unique NUM.

 

KEYPERC%CODE NUM
BGI80,30E1
BGI80,70T2
DEX90,17E1
DEX90,17E2
DEX90,17T1
DEX90,17T2
DEX90,48T

3

DEX90,32T4
AP20,16T1
AP20,08E2
AP20,35T3

 

So, for example, for KEY = DEX9 there are 6 lines, 4 of them with PERC% equal to 0,17. Therefore I have to select the row with CODE = E and NUM = 1, and row with CODE = T and NUM = 2, as shown in the resulting table below. 
And I need to do this for the general case, I mean, I should always check in the workflow if I have a case like this to properly handle it.

KEYPERC%CODE NUM
BGI80,30E1
BGI80,70T2
DEX90,17E1
DEX90,17T2
DEX90,48T3
DEX90,32T4
AP20,16T1
AP20,08E2
AP20,35T3

 

I've tried to use Unique Tool in different approaches and it doesn't work.

Any ideas?
Thanks in advance!

4 REPLIES 4
ShankerV
17 - Castor

Hi @jpscoralick 

 

One way of doing this!!!!

 

ShankerV_0-1682608042276.png

 

ShankerV
17 - Castor

Hi @jpscoralick 

 

Step 1: Input tool

 

ShankerV_0-1682608081591.png

Step 2: 

ShankerV_1-1682608100924.png

 

 

Step 3: 

ShankerV_2-1682608118589.png

 

ShankerV_3-1682608127431.png

 

Step 4:

 

ShankerV_4-1682608141923.png

 

ShankerV_5-1682608148085.png

 

Step 5:

 

ShankerV_7-1682608173609.png

 

IF [KEY]=[Row-1:KEY] AND [PERC%]=[Row-1:PERC%] AND [ NUM]=[Row-1: NUM]
THEN [ NUM]+1
ELSE [ NUM]
ENDIF

 

ShankerV_0-1682610597637.png

 

 

Many thanks

Shanker V

FinnCharlton
13 - Pulsar

Hi @jpscoralick ,

You can also do this with a filter and the Tile tool:

FinnCharlton_0-1682608454657.png

 

jpscoralick
8 - Asteroid

Thanks a lot, @ShankerV and @FinnCharlton, for the fast and useful solutions. All of them work perfectly.

Best regards!

 

Labels