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.
SOLVED

Create Additional Columns with a value calculated on the previous column

Bjoern
5 - Atom

Hej Everyone,

 

I am looking for some help or guidance on a problem creating multiple additional columns whose values are based on a formula that accesses the values of the previous column.

To be more specific: I have this data set of packUnits: 

 

ArticlePackUnitAvgGoodsInhelp_columnWeek_1
14810,2137,8
24825,9122,1
34842,615,42
 

I would like to "automatically add 25 additional columns, named: Week_2, Week_3, ....

For each of the new weeks the value needs to be calculated based on the values of the previous week. Formula is (e.g. for Week_2):

 

IF [AvgGoodsIn]<[Week_1] THEN [Week_1]-[AvgGoodsIn]

ELSE [PackUnit]*[help_column]-[AvgGoodsIn]+[week_1]

ENDIF

 

So, I end up for the next week with:

ArticlePackUnitAvgGoodsInhelp_columnWeek_1Week_2
14810,2137,827,6
24825,9122,144,2
34842,615,410,8

 

I would need this for approx. 25 additional weeks. Somehow I am stucked here. Someone who knows an answer of a Thread dealing with the same problem? Could not find anything.

 

Thanks and kind regards,

Bjoern

 

2 REPLIES 2
ntakeda
12 - Quasar

Hi, @Bjoern 

Step 1: Use the Generate Rows tool to create 25 rows vertically.
Step 2: Use the Multi-Row Formula tool to perform calculations based on the previous row.
Step 3: Use the Crosstab tool to transpose the data.

 

Please check the workflow for details.

2025-03-14_09h30_38.png

Bjoern
5 - Atom

@ntakeda 

 

Thanks a lot. Your way works just fine.

 

KR, Bjoern

Labels
Top Solution Authors