Get previous row/value/variable within detail section

I have the query result like this
TransactionDate Amount Debit/Credit StartingBalanceToday ------------------------------------------------------------------------- 2013-03-01 1000 C 1000 2013-03-01 100 D 1000 2013-03-01 200 D 1000

then i want to add new column "Balance" in the report like this

TransactionDate Amount Debit/Credit StartingBalanceToday Balance ------------------------------------------------------------------------------------- 2013-03-01 1000 C 1000 2000 2013-03-01 100 D 1000 1900 2013-03-01 200 D 1000 1700
"Debit/Credit" column determines whether the calculation is ADD or SUBSTRACT.
If "Debit/Credit" is "C" then the calculation is ADD, otherwise "Debit/Credit" is "D" then the calculation is SUBSTRACT
the formula for new column "Balance" -----> Balance = StartingBalanceToday -/+ Amount
then for the next "Balance" -----> Balance = Previous Balance -/+ Amount
nb: Previous Balance is the value of previous "Balance" how can I solve this problem? I have tried to use variable BALANCE to store the formula Balance = Previous Balance -/+ Amount but I dont know how to acces the previous variable Please help :) Thanks
b.eurika84's picture
Joined: Apr 2 2013 - 6:59pm
Last seen: 6 years 5 months ago

0 Answers:

No answers yet
Feedback
randomness