Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Using CONTAINS function while joining

ssubramanian
8 - Asteroid

Hi,

 

I have a requirement where -> Table A has Column = A_ID and Dept  ID and;  Table B has column B_ID and Dept_ID as below

 

Table A
IDDept
1A
1B
1C
2A
3C
3D
3E
Table B
ID Dept
1A,B
2A
3C,D

 

I need to join table A to B on ID and select the Depts in Table A that is present in Table B for the respective ID. For eg, ID = 1 Dept = A, ID = 1 and Dept = B is selected from Table A for ID = 1 as Depts - A and B are the only ID's listed in Table B

So I need to recreate this query in Alteryx:

" Table A INNER JOIN Table B ON A.ID = B.ID and Contains(B.Dept, A.Dept)"

 

Please suggest  a solution.

      

6 REPLIES 6
DavidP
17 - Castor
17 - Castor

How about this: Join on ID, then use a filter with the statement for B_Dept  Contains([B_Dept],[A_Dept])

 

join and contains.png

ponraj
13 - Pulsar

Here is the sample workflow for your case. Hope this is helpful. 

WorkflowWorkflowResultsResults

 

ssubramanian
8 - Asteroid

Thank you David. It worked!

ssubramanian
8 - Asteroid

Thank you Ponraj for attaching the workflow. Thank you for showing me another method of achieving it.

ponraj
13 - Pulsar

You can mark the workflow which really helped you to achieve the result as solution. 

Traci_Scherer
5 - Atom

Came across your solution while searching how to use Advanced Join with CONTAINS. Yours works perfectly and is much more straightforward. Your gift of knowledge is still giving!

Labels