How To Get Sum Of Previous Balance

Posted on 2003-03-30
Medium Priority
Last Modified: 2010-08-05
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.
Question by:shurid
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Author Comment

ID: 8235176
please some 1 help meeeeeeeeeee

Accepted Solution

ladylinet earned 320 total points
ID: 8240928
Group them by month, put running total into group footer, and save it to global variable before switching to next group.

Lady Linet

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question