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

How to perform a multi-field type of calculation on a table where 2 fields are variable

AndrewVogel
5 - Atom

I have a data table that holds the data I need to forecast sales from a product over the next 10 years. The data includes 10 fields each with the number of products sold in each year. The data also includes a further 10 fields with the price per product in each of these 10 years (see illustrative structure below):

 

ProductY1 salesY2 salesY3 sales...Y1 priceY2 priceY3 price...
X1050100 $1$1.50$2.00 
Y51025 $10$12$12.50 

 

What would be the easiest / most efficient way of performing the generic calculation:

 

Y[n] revenue = Y[n] sales * Y[n] price

 

Hence creating 10 new columns each with the corresponding years revenue? I would like to avoid having to use the formula tool and having a separate expression for each as the actual data set I am working with has a significantly larger number of fields. 

 

Any advice would be much appreciated

2 REPLIES 2
mceleavey
17 - Castor
17 - Castor

Hi @AndrewVogel ,

 

I used the Transpose and Crosstab tools to create the calculations. This will be future-proofed against additional rows.

 

This is the workflow:

 

mceleavey_0-1628710597888.png

 

Which gives the following results:

mceleavey_1-1628710656130.png

 

Hope this helps.

 

M

 

 



Bulien

AndrewVogel
5 - Atom

Great! Thanks @mceleavey 

Labels