INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Running Totals

Conditional Running Totals by HowardHammerman
Posted: 27 Oct 01

You may run into a situation where you want your Crystal Report to show many records, but to create a total for only some of them. The answer is a conditional running total.

Say, for example, you have a table of employees, and you want to show the entire roster, but you only want to total salaries for those employees with id numbers within a range specified by your users. Your first step is to create a parameter field - perhaps called EmpNum. In the Crystal Create (or Edit) Parameter Field dialog, we'll make our example a string data type, and click on the Range Value(s) radio button.

Now we create a running total - on the Employee_Salary field. It's a sum in the Crystal Create (of Edit) Running Total Dialog. The fun happens in the dialog's Evaluate section.

Click on the Use a Formula radio button. In the Running Total Condition Formula dialog that appears next, enter:

{EMPLOYEE.EMP_NUMBER} in {?EmpNum}.

This means, "OK, Crystal, don't add to my running total unless the employee's Employee Number is within the range that the user has specified." Naturally, you'll want to place your running total on the report - probably in the detail section to see how it works. It's best to sort the report on employee number, too.

When you run the report or refresh data, you'll be prompted for the lower and upper values for the employee number. If you use the samples from our website*, and enter (for example) 3 for the lower and 5 for the upper value, the running total field will be blank until you hit 3010, then will increase by each employee's salary until you hit 5000, and will not change again until the end of the report.

Howard Hammerman, Ph.D.
Hammerman Associates, Inc.
http://www.hammerman.com
800-783-2269
Hammerman Associates, Inc. provide Crystal Reports training,
consulting, course material, utilities and software. Consultants are available throughout North America for short or long-term assignments.

Back to Business Objects: Crystal Reports 4 Other topics FAQ Index
Back to Business Objects: Crystal Reports 4 Other topics Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close