I am trying to come up with a way to create a running balance in my select statement.
So I am alreay pulling back an Opening and Closing Balance per AccountId - I am basing that where the Rank column is equal to one.
From here what I want to achieve is for every subsequent row is have the previous BalanceCarriedForward placed into the row below it and the BalanceBroughtForward.
So the first row we start with 150.77 and we add the Total Value of 113.19 to get the BalanceCarriedForward in this case 263.96.
What I would want in in Rank 2 (row 2) the BalanceBroughtForward is 263.96 and then the BalanceCarriedForward in this case would be 377.15....and so on.
I'm struggling to work out the best way to populate the remaining BalanceBroughtForward and BalanceCarriedForward values from the 0.00 at the moment.
Rank 1 will always have starting figures.
Thanks