Alteryx Designer Desktop Discussions

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

Dynamic Filter

Kandemiro
7 - Meteor

Hey guys,

 

I have the following situation. I have two different queries with different results. See below:


Query 1:

SyntaxEditor Code Snippet

    Select distinct prod.prod_grp_id
    From AL_CDA_MM_NL.V_PRODS_ALL prod
    Inner Join AL_CDA_MM_NL.V_CRM_SALES sal
    on prod.prod_id = sal.prod_id
    where prod.prod_main_grp_id = 126 and
    sal.date_id > '2018-05-01'

 Resulting in the following table:

638
649
650
660
696
697
4.110
4.111
4.112

 

Query 2 only has a different prod_main_grp_id (namely 75 instead of 126) See below:

SyntaxEditor Code Snippet

    Select distinct prod.prod_grp_id
    From AL_CDA_MM_NL.V_PRODS_ALL prod
    Inner Join AL_CDA_MM_NL.V_CRM_SALES sal
    on prod.prod_id = sal.prod_id
    where prod.prod_main_grp_id = 75 and
    sal.date_id > '2018-05-01'

 Which results in this table:

335
330
380
331
332
342
333

 

I am using the results of these queries manually in the Filter Tool as follows:

 

[PROD_GRP_ID]== '638' or
[PROD_GRP_ID]== '649' or
[PROD_GRP_ID]== '650' or

[PROD_GRP_ID]== '660' or

[PROD_GRP_ID]== '696' or

[PROD_GRP_ID]== '697' or

[PROD_GRP_ID]== '4110' or

[PROD_GRP_ID]== '4111' or

[PROD_GRP_ID]== '4112'

 

But I don't want to write this into the Filter Tool manually each time I change the prod_main_grp_id.
I want the results to occur automatically in the Filter Tool. Is this possible?

 

With kind regards,

 

Önder Kandemir

2 REPLIES 2
JohnJPS
15 - Aurora

Hi @Kandemiro,

The Join Tool can work as a custom filter: e.g. take the results of that, just the single column in question, then join it against another dataset; only the matches  will appear in the middle output of the Join tool, effectively doing a filter for you.

Hope that help!

John

Kandemiro
7 - Meteor

Wow... yeah! Why didn't I think of that? That's an excellent solution indeed. Thank you very much John!

Labels