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
Classic1Database AdministratorAsked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.