We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Multiple rows but only one Unique ID - need to add to another column and remove the row

DBParker
6 - Meteoroid

I am new to alteryx and have an issue where my data has unique ID's but one of the columns can have multiple values, leading to a duplication of the unique ID in a table.  An example is below:

 

IDRep
1John
1Dave
2Rob
3Scott

 

I need to modify the output so that it comes out like below instead:

 

IDRep1Rep2
1JohnDave
2Rob 
3Scott 

 

Essentially, if it finds that the data has multiple Rep's for any of the unique ID's listed it would add a new column for each rep.  If there are 3 different Reps for any one ID then it would add two additional columns instead of just one and so on.

 

I have been unable to find a way to do this so any help would be appreciated!

4 REPLIES 4
Bob_Blackey
11 - Bolide

Hi,

 

Here's one way to do it:

 

Rep_Numbers.png

 

MULTI-ROW FORMULA: Add a rep number for each rep within an ID  (note the Group By check box)

FORMULA: Build the Rep1 , Rep2 text

CROSSTAB: Pivot the data

 

Cheers,

Bob

 

DBParker
6 - Meteoroid

This adds the additional column for ID 1, however, it continues to add columns for each ID beyond that as well.  See below:

 

IDRep1Rep2Rep3Rep4
1JohnDave  
2  Rob 
3   Scott

 

I need for Rob & Scott to be in the Rep 1 column since they are the only reps for that ID.  Plus in a larger data set this would have the potential of adding a very large number of columns that are not needed.

Bob_Blackey
11 - Bolide
Hi,
When I run it the results are in two columns as desired.
In the multi row formula tool I would check that you clicked ID in the "group by" section. That will reset the counter on every change in ID.

Cheers,
Bob
DBParker
6 - Meteoroid

That was the key.  Thanks much!

Labels
Top Solution Authors