shurid
asked on
How To Get Sum Of Previous Balance
I am grouping my reports monthly date wise. And in each month i need to get the previous sum of payments with condtions.
my table is like this:
Table Name : voucher
-------------------------- ---------- ---------- ---------- ----------
SlNo | Date | Amount | Account |PaymentOrReceipt
-------------------------- ---------- ---------- ---------- ----------
1 14/1/2003 100 Cash Receipt
2 14/2/2003 100 Cash Receipt
3 16/2/2003 10 Cash Payment
4 18/2/2003 50 Other Payment
5 1/3/2003 400 Cash Receipt
6 15/3/2003 20 Cash Payment
-------------------------- ---------- ---------- ---------- ---------- --
Result Should be Like This (Group By Monthly)
-------------------------- ---------- ---------
Month : 03/2003
CurentBalance = 380
PreviousBalance = 190 //Not 100 Cos SlNo 3 Is Not Cash Account
Total= 570
-------------------------- ---------- ---------
Month : 02/2003
CurentBalance = 90
PreviousBalance = 100
Total= 190
-------------------------- ---------- ---------
Month : 01/2003
CurentBalance = 100
PreviousBalance = 0
Total= 100
-------------------------- ---------- ---------
I can find out everything except find out previous balance.
My Questions:
1. How to find previous Balance?
2. How to create a function using sum() function with where condtions.
3. Example Of Crystal reports (SQL Expression Field).
I am using Crystal Report 9.
my table is like this:
Table Name : voucher
--------------------------
SlNo | Date | Amount | Account |PaymentOrReceipt
--------------------------
1 14/1/2003 100 Cash Receipt
2 14/2/2003 100 Cash Receipt
3 16/2/2003 10 Cash Payment
4 18/2/2003 50 Other Payment
5 1/3/2003 400 Cash Receipt
6 15/3/2003 20 Cash Payment
--------------------------
Result Should be Like This (Group By Monthly)
--------------------------
Month : 03/2003
CurentBalance = 380
PreviousBalance = 190 //Not 100 Cos SlNo 3 Is Not Cash Account
Total= 570
--------------------------
Month : 02/2003
CurentBalance = 90
PreviousBalance = 100
Total= 190
--------------------------
Month : 01/2003
CurentBalance = 100
PreviousBalance = 0
Total= 100
--------------------------
I can find out everything except find out previous balance.
My Questions:
1. How to find previous Balance?
2. How to create a function using sum() function with where condtions.
3. Example Of Crystal reports (SQL Expression Field).
I am using Crystal Report 9.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER