Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

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

Multi-Row Formula - Calculating running balances based on values of row above

PhongVo
7 - Meteor

Hoping someone could please help me with the multi-row formula to calculate the balances based on the credit and debit activity and the given balance at the above row. Also "referencing" to account and "weekending". Please see attached picture

 

clipboard_image_1.png

2 REPLIES 2
TonyA
Alteryx Alumni (Retired)

MultiRow formulas reference other values by row using relative notation (Row-1, Row+1, etc.) They reference by column using the field name (Account, Weekending, etc.).

So the formula for Balance becomes:  [Row-1:Balance] + [Credit] - [Debit]

We do need to add a condition to make sure we don't replace the balance values that already exist. As far as referencing Account or Weekending, we would use the same notation with the appropriate column name.

 

I've attached an example that uses your data to calculate the balances. There are two techniques shown. In the first, I group by Account and calculate the value if the current value is null. In the second, I directly reference the Account and keep the current value of balance if the Account has changed from the previous row.

PhongVo
7 - Meteor

Thanks TonyA, it works perfectly

Labels