Dear Alteryx Ninjas!
Hope all is well.
I wanted to see if you guys had any insights to enhance or improve my following methodology. I spent quite the time coming to this solution, and I am sure there are many ways to do achieve the same, and I am curious to see how you would solve it.
Specifically, I want to calculate the rate of change for a country every month from January to April (I have aligned my data to show the first four months for all countries). The data looks like this:
| Country | Month | Month numeric | Var | Delta |
| Argentina | JAN | 01 | 3 | |
| Argentina | FEB | 02 | 2 | |
| Argentina | MAR | 03 | -1 | |
| Argentina | APR | 04 | -11061 | |
I used the following formula in the multi-row tool:
IF [Month numeric] = "01"
THEN [Var]
ELSEIF [Month numeric] = "02"
THEN [Row-1:Var] + [Var]
ELSEIF [Month numeric] = "03"
THEN [Row-1:Delta] + [Var]
ELSE [Row-1:Delta] + [Var]
ENDIF
These is my tool config:
- 1. Create new field
- 2. Group By: Country
This is my desired output:
| Country | Month | Month numeric | Var | Delta |
| Argentina | JAN | 01 | 3 | 3 |
| Argentina | FEB | 02 | 2 | 5 |
| Argentina | MAR | 03 | -1 | 4 |
| Argentina | APR | 04 | -11061 | -11057 |
Thank you all in advance for your time and responses.
Best,
Juan1