Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Opposite of running total

shravanvijayaprasad
8 - Asteroid

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:

 

YearQuarterAmount
2018Q110
2018Q240
2018Q380
2018Q490
2019Q1100
2019Q2400
2019Q3800
2019Q4900

 

After:

 

YearQuarterAmountAmount_Periodic
2018Q11010
2018Q24030
2018Q38040
2018Q49010
2019Q1100100
2019Q2400300
2019Q3800400
2019Q4900100

 

Could someone please help me with a workflow for the same? Thanks

6 REPLIES 6
fmvizcaino
17 - Castor
17 - Castor

Hi @shravanvijayaprasad ,

 

This should do it.

Take a look and let me know if this makes sense to you.

 

Best,

Fernando Vizcaino

CharlieS
17 - Castor
17 - Castor

Hi @shravanvijayaprasad 

 

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.

JosephSerpis
17 - Castor
17 - Castor

Hi @shravanvijayaprasad I mocked up a workflow let me know what you think?

 

Quarters_17022020.JPG

shravanvijayaprasad
8 - Asteroid

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,

shravanvijayaprasad
8 - Asteroid

@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?

CharlieS
17 - Castor
17 - Castor

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

Labels
Top Solution Authors