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

Rows to columns based on id and date

Analytics_Pooja
8 - Asteroid

I have a dataset with ID, names and year. Each ID has multiple records with different names and their corresponding year of joining. I want to transpose data based on ID and the year of joining. 

 

Each row should have unique ID

Name column will be split into Name1, Name2, Name3 and so on

Name1 column should contain date with earliest year of joining followed by Name2 and then Name3

 

For ID as 1 the name1 column contains John as  John has the earliest joining date for ID as 1

 

Input   
IDNameYear 
1Steve2008 
1Neha2006 
1John2005 
2Nisha2012 
2Natasha2021 
2Natila2000 
3Richard2014 
3Rishabh2013 
    
Output   
IDName1Name2Name3
1JohnNehaSteve
2NataliaNishaNatasha
3RishabhRichard 

 

If there is more than 1 Name for an ID then additional names will be transposed to another filed based on the date of joining. 

 

Much appreciate your help.

 

Best

Pooja 

 

5 REPLIES 5
TheOC
16 - Nebula
16 - Nebula

Hi @Analytics_Pooja 

I believe i have created what you need. 

TheOC_0-1646177273268.png

 



Please find attached.

Cheers,
TheOC

Cheers,
TheOC
Connect with me:
LinkedIn Bulien
Qiu
21 - Polaris
21 - Polaris

@Analytics_Pooja 
I like to use Tile tool in this case.

0303-Analytics_Pooja.PNG

Analytics_Pooja
8 - Asteroid

Thanks @TheOC  . 

 

There are 2 logics that I am still having an issue. 

 

1. IDs are not always in sequence

2. The number of records can be more than 3 for each ID. I also need to increment the column name accordingly like Nmae1, Name2, Name3 and so on..

 

Best

Pooja

TheOC
16 - Nebula
16 - Nebula

hey @Analytics_Pooja 

No problem we can first sort data by dates, and then use a formula to rename the id fields.

Please find attached.

Hope this helps,
TheOC

Cheers,
TheOC
Connect with me:
LinkedIn Bulien
Analytics_Pooja
8 - Asteroid

Thanks @TheOC . This works

Labels
Top Solution Authors