Alteryx Designer Desktop Discussions

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

Multi-Row Formula Tool: Month Over Month Variance

amandaj4123
7 - Meteor

I could really use some expertise here.  I've attached a dataset, also below, which is appended with new data every month, for 12 months.  As of now, I have the last month of previous year, for comparison, and Jan-Mar.  For each unique "Identifier",  I need to calculate the month-over-month variance of Amt2.

(i.e. JAN Amt2 divided by 2018DEC Amt 2, FEB Amt2 divided by JAN Amt2, etc) I have to keep in mind that the formula must adjust to the number of months currently within the dataset, and still process successfully with new months added.  Your help is greatly appreciated!

 

CONTROLIdentifier#Mths LoadedEarnings MthEffective End DateMth#Amt1Amt2Amt3Month over Month Variance
2018DEC12345678Canada1234567842018DEC2019-01-312018127520.327520.327520.32 
JAN12345678Canada123456784JAN2019-02-282019016432.010.006432.01 
FEB12345678Canada123456784FEB2019-03-312019026432.016432.010.00 
MAR12345678Canada123456784MAR2019-04-302019038445.636483.8510000.00 

 

IF [Row+1:IDENTIFIER]=[IDENTIFIER] THEN [Row+1:Amt2]/[Amt2]) ELSEIF [Row+2:IDENTIFIER]=[Row+1:IDENTIFIER] THEN [Row+2:Amt2]/[Row+1:Amt2] ELSEIF [Row+3:IDENTIFIER]=[Row+2:IDENTIFIER] THEN [Row+3:Amt2]/[Row+2:Amt2] ELSEIF [Row+4:IDENTIFIER]=[Row+3:IDENTIFIER] THEN [Row+4:Amt2]/[Row+3:Amt2] ELSEIF [Row+5:IDENTIFIER]=[Row+4:IDENTIFIER] THEN [Row+5:Amt2]/[Row+5:Amt2] ELSEIF [Row+6:IDENTIFIER]=[Row+5:IDENTIFIER] THEN [Row+6:Amt2]/[Row+5:Amt2] ELSEIF [Row+7:IDENTIFIER]=[Row+6:IDENTIFIER] THEN [Row+7:Amt2]/[Row+6:Amt2] ELSEIF [Row+8:IDENTIFIER]=[Row+7:IDENTIFIER] THEN [Row+8:Amt2]/[Row+7:Amt2] ELSEIF [Row+9:IDENTIFIER]=[Row+8:IDENTIFIER] THEN [Row+9:Amt2]/[Row+8:Amt2] ELSEIF [Row+10:IDENTIFIER]=[Row+9:IDENTIFIER] THEN [Row+10:Amt2]/[Row+9:Amt2] ELSEIF [Row+11:IDENTIFIER]=[Row+10:IDENTIFIER] THEN [Row+11:Amt2]/[Row+10:Amt2] ELSEIF [Row+12:IDENTIFIER]=[Row+11:IDENTIFIER] THEN [Row+12:Amt2]/[Row+11:Amt2] ELSE "" ENDIF

2 REPLIES 2
OllieClarke
15 - Aurora
15 - Aurora

If you group by indentifier in the multi-row formula tool, then the formula

[Amt2]/[row-1:Amt2]

will give you your monthly variance. (the nulls are from dividing by 0, and for being the first row - you can change this in the 'Values for Rows that don't Exist' settings

mom.PNG 

amandaj4123
7 - Meteor

Well, this certainly worked!  Thanks for the simplification.  I guess I was just too close to it to see it.

Labels