4 Replies Latest reply on Mar 21, 2017 3:58 PM by Jonathan Drummey

# Previous row balance to use in current row

Hi All,

I have requirement like I have data with different months (monthyear dimension) and different measures. So using these three measure I will get balance every month so closing of the last month balance will be opening balance of current month so I want to use that close balance value in my current month for calculation.

I have attached a excel sheet with some logic in it when you with data. In that Value of Value A is Balance of column F

So need calculation to achieve this. Early solution will be appreciated.

• ###### 1. Re: Previous row balance to use in current row

Kumar,

Check out the LOOKUP() function as it allows you to reference other rows in your view: https://onlinehelp.tableau.com/current/pro/desktop/en-us/help.htm#functions_functions_tablecalculation.html?Highlight=lo…

Hope that helps!

Joshua

• ###### 2. Re: Previous row balance to use in current row

Here’s a view:

The Balance is computed using a formula with PREVIOUS_VALUE() which lets Tableau carry forward values.

The New Value A calculation uses LOOKUP() as Joshua had referenced to use the prior month’s Balance.

Jonathan

• ###### 3. Re: Previous row balance to use in current row

Hi Jonathan,

This helps almost for my solution, but small change here, in my data for everymonth value A is constant in that case how the calculation should be done for Balance.

Thanks for help in advance once again.

• ###### 4. Re: Previous row balance to use in current row

I don't understand. In what you'd provided value A was the prior month's balance, so how is it a constant?

Jonathan