• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 370
  • Last Modified:

Creating Totals in Crystal Reports with Formula Fields

Hi there,
I was wondering how can I add totals to the last 3 columns (please view the screenshot for more clarity). Each column is a formula, where CCF takes the current Corr. Volume substracted by the previous Corr. Volume. e3m3 is calculated by taking the CCF multiplying by a static value. GJ is calculated by e3m3 multiplied by a parameter.
The department would like to have grand totals at the bottom, but when I try an insert, there's no option for me...

Please let me know if you need more details/information...

Much appreciated,
Classic
Crystal.jpg
0
Classic1
Asked:
Classic1
  • 2
1 Solution
 
mlmccCommented:
You can use a running total on the formula or in the formula do the total

WhilePrintingRecords;
Global NumberVar MyTotal;
Local NumberVar DispValue;
DispValue := {YourField} - Previous({YourField});
MyTotal := MyTotal + DispValue;
DispValue

To display the total
WhilePrintingRecords;
Global NumberVar MyTotal;
MyTotal

mlmcc
0
 
ravenblueCommented:
You can't summarize fields that use 'previous'.

You'll need to use shared variables and build the total's manually as follows:

new formula of say initialize_CCF

shared numbervar ccf_tot;
ccf_tot = 0

place this in the page header (or group header if you want subtotals by group)

2nd formula of say sum_CCF
shared numbervar ccf_tot;
ccf_tot = ccf_tot + {Exising CCF formula)

place this in the details section


3rd formula of say display_CCF
shared numbervar ccf_tot;
ccf_tot

drop this in the report where you want the total to appear.

Then, do exactly the same (just change the formulae and variable names) for the other 2 columns
0
 
ravenblueCommented:
should have read:

Was this comment helpful? Yes No
You can't summarize fields that use 'previous'.

You'll need to use shared variables and build the total's manually as follows:

new formula of say initialize_CCF

shared numbervar ccf_tot;
ccf_tot := 0

place this in the page header (or group header if you want subtotals by group)

2nd formula of say sum_CCF
shared numbervar ccf_tot;
ccf_tot := ccf_tot + {Exising CCF formula)

place this in the details section


3rd formula of say display_CCF
shared numbervar ccf_tot;
ccf_tot

drop this in the report where you want the total to appear.

Then, do exactly the same (just change the formulae and variable names) for the other 2 columns
0
 
Classic1Database AdministratorAuthor Commented:
Beautiful!!! Works like a charm, and quite simplistic...

Thanks again!!!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now