I think this might be simple but I'm not able to figure this out. I have a data set with the running totals and I want to get the periodic numbers
Before:
Year | Quarter | Amount |
2018 | Q1 | 10 |
2018 | Q2 | 40 |
2018 | Q3 | 80 |
2018 | Q4 | 90 |
2019 | Q1 | 100 |
2019 | Q2 | 400 |
2019 | Q3 | 800 |
2019 | Q4 | 900 |
After:
Year | Quarter | Amount | Amount_Periodic |
2018 | Q1 | 10 | 10 |
2018 | Q2 | 40 | 30 |
2018 | Q3 | 80 | 40 |
2018 | Q4 | 90 | 10 |
2019 | Q1 | 100 | 100 |
2019 | Q2 | 400 | 300 |
2019 | Q3 | 800 | 400 |
2019 | Q4 | 900 | 100 |
Could someone please help me with a workflow for the same? Thanks
Solved! Go to Solution.
Hi @shravanvijayaprasad ,
This should do it.
Take a look and let me know if this makes sense to you.
Best,
Fernando Vizcaino
This can be done with a Multi Row Formula tool.
https://help.alteryx.com/current/MultiRowFormula.htm
Check out the attached workflow to see it in action in this scenario. Let me know if you have any questions.
I do like this solution but what if it isn't ordered in the exact way I had given and Q1 is followed by Q3 and then Q2 and so on.
Thanks,
@CharlieS There is an issue when you move from Q4 2018 to Q1 2019. Q1 2019 in my data starts afresh. Thanks though.
Another question is what happens if the data isn't ordered, is the only way to order the data and then do the same?
@shravanvijayaprasad wrote:@CharlieS There is an issue when you move from Q4 2018 to Q1 2019. Q1 2019 in my data starts afresh. Thanks though.
Another question is what happens if the data isn't ordered, is the only way to order the data and then do the same?
Ah yes, The Multi Row Formula tool has an optional "Group By" setting for that. I selected "Year" in this case and we're good to go.
If the records are out of order, use a Sort tool to get things arranged before the periodic calculation. I have applied both these changes in the attached workflow.
User | Count |
---|---|
19 | |
14 | |
13 | |
9 | |
8 |