Print Page | Close Window

Summing up a summarized field

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=8968
Printed Date: 04 May 2024 at 3:15am


Topic: Summing up a summarized field
Posted By: vaibhav123
Subject: Summing up a summarized field
Date Posted: 28 Jan 2010 at 5:32am
Hello,

I have a summary field which is basically a count on one of the data fields. So, my report looks like this:

Name       Numbers
A                 10
B                15
C                 10

The numbers above are a count of some field in the database. Now, what I am trying to achieve is get the sum of these numbers i.e. somehow get 35 as the grand total. I tried using a simple formula, but got a message that " summary field can not be summarized"

I was wondering if there is a way to get the desired total in this case. Any help is highly appreciated.




-------------
-V



Replies:
Posted By: arnold
Date Posted: 29 Jan 2010 at 2:07am
hi,

try to set the formula in the range that prints every line of your data like this_:

___________________________
formulat that initiates the var
___________________________
---------------------------
Name numbers   formula2
---------------------------

The variables for that must be initiated sowhere in the Head like this:
shared numbervar varyourvarname:=0;

then you use another formula, in this case formula2 like this:

shared numbervar varyourvarname;
varyourvarname:=varyourvarname+your summary field

What ist does:
in the head the var is set to zero.
It then comes to the first detailrange and adds your first summaryfield to the var, in this case your var is 10.
then it advances to the second detailrange/data and adds again 15, so the var has now a value of 25.
and so on.
At the end you should have a value of the var that is 35 as expected. Now you can show this var everywhere in your report with a formula like this:
shared numbervar varyourvarname;

the formula that adds the values of the summary field can be suppressed without any criteria, because it is executed anyway.


Another way to solve that problem could be:
you summarize with a formula instead of using a sum field and then you can summarize over that formula to get your sum in the end.

hope this help

kind regard
Markus



Print Page | Close Window