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

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

## 0 Answers:

*No answers yet*