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.

Please help with calculating change between rows

ericren
8 - Asteroid

Hi Alteryx Community,

 

I have a historical data set.

 

ABC
3434343467
56533565
23423456
343434343434
343445
2343523
235645
235645645
232323
234556

 

 

Each day I get a new data set.

 

 

ABC
3424334617

 

 

 

I would like to append this data set to the historical data set. 

 

Then calculate changes between rows and also % change between rows.

A is current row 

A-1 is previous row. 

Same for B and C. 

 

 

ABC  A - (A-1) (A-(A-1)) / (A-1) B - (B-1) (B-(B-1) / (B-1)C - (C-1)(C - (C-3))/(C-3)
3434343467 #VALUE!#VALUE!#VALUE!#VALUE!########VALUE!
56533565 -2869-0.835468841-3401-0.990390215498#DIV/0!
23423456 -331-0.5858407082016.090909091-509#VALUE!
343434343434 320013.67521368320013.67521368337850.41791045
343445 -3400-0.99009901-3400-0.99009901-3389-5.998230088
2343523 -11-0.32352941240111.79411765-22-0.392857143
235645 00-379-0.871264368220.006406523
235645645 00564001007.14285700
232323 00-56433-0.999592603-22-0.956521739
234556 00220.956521739330.733333333

 

I would like to append the new data set to the first 3 rows and calculate the rest of the columns for daily change and % change. 

 

Please help I am stuck, thank you so much. 

 

4 REPLIES 4
lwolfie
11 - Bolide

I think you are looking to use the Multi-Row Formula tool with a union.  Check out this sample workflow.  You could repeat for the other columns as needed.

amanda_payne
8 - Asteroid

If it's only a few fields then you can accomplish with a few multi-row tools:

 

amanda_payne_0-1682533917915.png

 

RobertOdera
13 - Pulsar

Hi, @ericren 

 

Kindly consider the below.

I hope you find it helpful - Cheers!

 

Please note divide by zero and zero divided by num are different mathematical outcomes😎

IF [RecordID] =1 THEN Null()
ELSEIF IsEmpty([Row-1:A]) THEN Null()
ELSEIF [Row-1:A] =0 THEN Null()
ELSEIF [Diff_A] =0 THEN 0
ELSE [Diff_A]/[Row-1:A]*100
ENDIF

 

or something like that...

 

RobertOdera_0-1682534519681.png

 

ericren
8 - Asteroid

It is giving me an error for me to import it. It is a newer version. :(

Labels
Top Solution Authors