Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Split and transpose fields based on similar variable

natyeo
5 - Atom

Hi, 

 

I was hoping to get some help. I have a table that currently looks like this: 

Table 1.

Suburb #2006 A2011 A2016 A2006 B2011 B2016 B
123411239171
456811710110

 

I am trying to get the table down to:

Table 2.

Suburb #VariableYearValue
123A20064
123A201111
123A201623
123B20069

 

I understand I can transpose Table 1 where all the headers become rows and suburb # is repeated but how do I tidy up the variable names and create a new column 'Year' in the process? 

 

Thanks heaps in advance!

6 REPLIES 6
fmvizcaino
17 - Castor
17 - Castor

Hi @natyeo ,

 

I'm attaching a workflow that does the job.

 

TAke a look and let me know if this makes sense to you.

Best,

Fernando Vizcaino

natyeo
5 - Atom

Hi Fernando, 

 

Thanks heaps for the swift response! 

 

That looks like a perfect solution, if my titles were uniformly labelled. Sorry, I should have mentioned.. 

 

Is there a way to split columns based on their values? 

fmvizcaino
17 - Castor
17 - Castor

Hi @natyeo ,

 

Sure there is a way! Please share an example of how your titles are so I can try to find a way 🙂

Best,

Fernando V.

natyeo
5 - Atom

Hi Fernando, 

 

This is pretty much my working file thus far. 

 

Thanks!

Nat

fmvizcaino
17 - Castor
17 - Castor

Hi @natyeo ,

 

Attached is my solution. I was able to separate the year from anything else using 2 regex tools.

 

One thing you need to still adapt is to standardize the variable column if needed and that you can do similarly to what I've done with find/replace tool to find the years.

 

Please insert the workflow in the same folder as the input file.

 

Best,

Fernando Vizcaino

natyeo
5 - Atom

Wow. that's brilliant. Thank you so much for that Fernando, I really appreciate it. 😃 

Labels