# Thread: Report total from group expression

1. Member
Join Date
Feb 2007
Posts
35

## Report total from group expression

Is it possible, in PRD 3.0 o 3.5, to make a "report sum" of value that comes from a formula calculation in a group footer?
Thank you.  Reply With Quote

2. Chief Reporting Bug Planter
Join Date
Mar 2003
Posts
8,085

## Well, sums always work over all the rows of a group. So we do sum the stuff we find when the itemband gets printed.

But: Why dont you simply repeat your calculation with an additional sum that runs over the whole report?

So lets assume your group contains the formula

=[Group_SUM_of_A] * [Group_SUM_of_B]

where Group_SUM_of_A and Group_SUM_of_B are Sum-Functions that have the "field" and "Group" properties defined.

Then add two new Sum-functions "Report_SUM_of_A" and "Report_SUM_of_B" and only defined the field, and leave the group property empty. Then use the same formula as above, but this time reference the Report_SUM fields/functions.

If you really need a different calculation schema, then you are always free to implement your own function to do that. But I'm afraid that there is no build in solution for your kind of calculation.  Reply With Quote

3. Member
Join Date
Feb 2007
Posts
35

## I don't have Itemband, I only print "group footer" and "report footer".
In the "group footer" I make a division (ColumnDivisionExpression) between a TotalGroupSumFunction and a field from db, and then print the result for each group, say Result_1.
In the "report footer" I need to sum the Result_1 of every group.
I tried in many different ways but I was not able to obtain this result.
It seems like that "group footer" band do not pass the value of this division to the "report footer".
Thank you.  Reply With Quote

4. Chief Reporting Bug Planter
Join Date
Mar 2003
Posts
8,085

## You may not *print* anything there, but the reporting engine still has rows that are processed in the itemband stage.

Lets call the field you sum up "sum-field" and the field you divide by the "div-field".

Under the assumption that div-field has the same value within each group, we can rewrite your calculation from:

[sum-field](1) + [sum-field](2) + .. + [sum-field](n)) / [div-field]

to

([sum-field](1) / [div-field]) + ([sum-field](2) / [div-field]) + .. + ([sum-field](n) / [div-field])

(Or in Mathematicians terms: Just a simple application of the distributivity rule)

Add a formula (or if you prefer stick with the ColumnDivisionExpression) that sums:

=[sum-field] / [div-field]
Lets name the formula "div-sum".

Now make a Group-Sum or Total-Group-Sum (there is no difference in your case) to sum them for the group and a second group-sum to sum them for the whole report.

Case solved.  Reply With Quote

5. Member
Join Date
Feb 2007
Posts
35

## I just did this, like you suggest:
in a ColumnDivisionExpression, in the group footer band: [sum-field] / [div-field]
and I put it in a number field, say "div-sum" .
Now I tried to make the sum for the report(so, first the division then the sum).
But when I make the TotalGroupSumFunction of the that field ("div-sum") in the report band, I have strange value; anymore, this value is always different every time I run the report.
So, it seems that the report footer band is not able to take some value from the group footer band.
Thank you for help me.  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•