Alteryx Designer Desktop Discussions

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

Join single column of data from one set to multiple columns in another

Rob48
8 - Asteroid

I'm working in version 2021.4.

 

I have two sets of data that look like this:

 

Employee CodeEmployee Supervisor CodeEmployee MGR CodeEmployee Group VP CodeEmployee Supervisor Pay GradeEmployee MGR Pay GradeEmployee Group VP Pay Grade
AAAAAA111AAAAAA222AAA333---
BBBBBB111BBBAAA223AAA334---
CCCCCC111CCCAAA224AAA335---
DDDDDD111DDDAAA225AAA336---
EEEEEE111EEEAAA226AAA337---
FFFFFF111FFFAAA227AAA338---

 

Employee CodeEmployee Pay Grade
AAAAAAA1
BBBBBBA2
CCCCCCA3
DDDDDDA4
EEEEEEA5
FFFFFFA6
111AAAB1
111BBBB2
111CCCB3
111DDDB4
111EEEB5
111FFFB6
AAA222C1
AAA223C2
AAA224C3
AAA225C4
AAA226C5
AAA227C6
AAA333D1
AAA334D2
AAA335D3
AAA336D4
AAA337D5
AAA338D6

 

 

 

 

I need to join them so the resulting data looks like this:

 

Employee CodeEmployee Supervisor CodeEmployee MGR CodeEmployee Group VP CodeEmployee Supervisor Pay GradeEmployee MGR Pay GradeEmployee Group VP Pay Grade
AAAAAA111AAAAAA222AAA333B1C1D1
BBBBBB111BBBAAA223AAA334B2C2D2
CCCCCC111CCCAAA224AAA335B3C3D3
DDDDDD111DDDAAA225AAA336B4C4D4
EEEEEE111EEEAAA226AAA337B5C5D5
FFFFFF111FFFAAA227AAA338B6C6D6

 

 

right now I'm playing with copying all the Supervisor/Manager/VP codes directly into the pay grade columns, then use find and replace once each per column to get the pay grades in, but this seems messy and too many repeating steps, and the issue is my actual data that the first table represents has many more than 3 columns, more like 10-15. 

 

My second table is only two columns like the example.

 

Is there a quicker way to integrate the two data sets than manually adding in multiple Find/Replace or Join tools so I can get to the last table format?  Thanks for any help you can provide.

 

  

 

3 REPLIES 3
danilang
19 - Altair
19 - Altair

Hi @Rob48 

 

Any time you have a situation where you need to perform the same operation on multiple columns, always consider whether it might be more efficient to transpose the columns to name/value pairs.  This allows you to perform a single operation on the new pair of columns and also guards against the case where the columns can change in future scenarios.

 

danilang_0-1685980790288.png

Here I transpose the columns in question and then perform a single Join on the Pay Grade table to get all the related pay grades.  Cross tabbing this new data gives us a new set of three columns that can be joined back to the original data.  The other tools in the workflow are to build the new pay grade column names and to deal with the issue that the Cross Tab tool can position the new columns alphabetically, as opposed to logically.  You get around that by using an integer field, [ColumnOrder] as the new column names and then use a Dynamic Rename to set the correct field names.

 

danilang_1-1685981117758.png

Dan

 

summit_view
8 - Asteroid

HI @Rob48 

I Transposed the Data and then used Cross Tab to get it back into records by record ID (employee).  I split the data to do the cross tab of code and pay grade separately.

 

summit_view_0-1685981431699.png

summit_view_1-1685981479307.png

 

 

albert_alaluf
9 - Comet

Hello @Rob48 

 

Do you think this works for you?

 

Labels