Alteryx Designer Desktop Discussions

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

How to create multiple columns based on some conditions

wcamarg3
8 - Asteroid

Hi all,

 

I hope anyone can help me.

 

I have a table which has the "Line", the "Operation" and the "Serial Number".

 

LineOperationSerial Number
A_ONE10123782
A_ONE20123783
B_ONE20123784
B_TWO30123785
C_ONE40123786

 

And I would like to create another columns segregated by the "Line" and "Operation" name containing the respective Serial Numbers inside these columns.

To better understanding follow below the desired output:

 

A_ONE OP10A_ONE OP20B_ONE OP20B_TWO OP30C_ONE OP40
123782123783123784123785123786

 

Thanks,

 

Wil

5 REPLIES 5
AngelosPachis
16 - Nebula

Hi @wcamarg3 ,

 

You can use a formula tool to form the column headers and then cross tab your table to get the desired output

 

AngelosPachis_0-1629721429451.png

 

Hope that helps,

Angelos

atcodedog05
22 - Nova
22 - Nova

Hi @wcamarg3 

 

Here is how you can do it.

Workflow:

atcodedog05_0-1629721660456.png

 

1. Using formula tool to create new column name.

2. Using formula tool to convert serial number int datatype to string.

3. Using crosstab tool to convert to table.

4. Using dynamic rename to fix the names.

 

Hope this helps : )

 

wcamarg3
8 - Asteroid

Thank you @AngelosPachis!

wcamarg3
8 - Asteroid

Thank you @atcodedog05

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @wcamarg3 

Cheers and have a nice day!

Labels