community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Using CONTAINS function while joining

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.

      

Pulsar

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

Quasar

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

workflow.PNGWorkflowResults.PNGResults

 

Asteroid

Thank you David. It worked!

Asteroid

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

Quasar

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

Labels