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.

Add X columns based on value in cell

ramkrau
5 - Atom

I have a workflow where a column is created to count the number of times something happens.

 

I need alteryx to look at that column, find the highest value, and then add that number of columns to my output file.

 

For example, the column has values:

 

1

1

3

5

2

19

3

 

I need the output file to create 19 new columns with column-header 1 through 19.

 

Thanks in advance!

 
 
 
 
3 REPLIES 3
Luke_C
17 - Castor
17 - Castor

Hi @ramkrau 

 

Here's an example on how to take the max value, generate a row up to the max, then crosstab those to columns. Hopefully gets you started on the right path.

Luke_C_0-1666300847899.png

 

 

binuacs
21 - Polaris

@ramkrau One way of doing this

 

binuacs_0-1666301131313.png

 

danilang
19 - Altair
19 - Altair

Hi @ramkrau 

 

If you need to add the new columns to your existing data, Use an Append Fields tool and connect your input table to the T input and the output of @binuacs workflow to the S input

 

Dan

Labels