Wednesday, March 19, 2008

Calculating Total on specific conditions CR.NET Crystal Reports

Creating Running Totals

The best method available to you to learn how to do this is to look over our Running Total Whitepaper. It gives lots of examples and explains in full detail the methods that you will need to use to create the running totals in your report. To get our running total whitepaper, please download it from our website at the following link:

Once there, please do a search and download the following documents:

With Crystal Reports you cannot create a summary field base on a formula with a summary field. What you will need to do is use-running totals. There are three formulas you are to create. One is to reset the variable you are going to create to contain the total of your running total. One is to do the actual calculation and the last one is to display the running total.

The Reset Formula:

The following formula is to be place in your group header so it will reset the variable on the change of each new group. X is the name of the variable
Numbervar X := 0

The Calculation Formula:

Place this formula in the detail section.

Numbervar X:=X +{fieldnametoaddup}

***For duplicate records the formula would look like this***

If onfirstrecord or previous({fieldname})<>{fieldname} then
Numbervar X:= X + 1

***For Conditionally Suppressed Records***

You will have to include the suppression condition in the formula for example:
Lets say you have record #51 suppressed then the formula should look like this:

If {fieldname} <> 51 then numbervar X:=X+1

This means the running total will only add one for every record as long as it is not 51.

The Display Formula

Place this formula in the group footer to display the result

Numbervar X;

Original Article at :

1 comment:

Anonymous said...

me and my wife have been researching 2012 for about 2 years now and have allready started planning they say by 2010 you will see it in the sky and i think thats about the time we will have everything ready we are looking to start a survival group or if anyone else has one that we can join let me know ill check back later thanks
]2012 end of the world
[/url] - some truth about 2012