# Thread: Sum of Summarized fields

1. Registered User
Join Date
Aug 2006
Posts
1

## Unanswered: Sum of Summarized fields

Any help would be appreciated.

I have a report that is summarizing two amounts based on group #1, account number. Previous Total and Existing Total.

I then have a formula, @Difference that calculates the difference, Existing - Previous

I then have a third formula, Net Amount, that says if @Difference > 0 then @Difference else 0.

All of these formulas are working just fine. However, I now want to Sum the third formula Net Amount in the Report Footer. However, I am getting error messages saying that the Net Amount cannot be summarized. I've tried using ToNumber, I've tried making it a Local Numbervar, and I'm out of ideas.

Any help in getting Crystal to summarize this field would be greatly appreciated.

Thanks

2. Registered User
Join Date
Dec 2004
Location
Connecticut
Posts
85
I've found that when Crystal doesn't give you the option to summarize, you can declare a new variable and set it to accumulate the field you need to summarize. Like this

Code:
```WhilePrintingRecords;
NumberVar Report_Summary_Field:=Report_Summary_Field  + {@Calculated_Summary_Field];```
Put this new field at the same footer level as the original summary field, so that it will accumulate every time the original summary field appears.

Once you're sure it's accumulating properly, put a copy of the new field at the next footer level.

If your summary isn't a Grand Total, you'll need to reset the variable to zero at the appropriate header level with another field. Like this

Code:
```WhilePrintingRecords;
NumberVar Report_Summary_Field:=0```
There's probably a different/better way, but I haven't found it, yet.

3. Registered User
Join Date
Oct 2005
Posts
119
hi trowe,

i already got the sum of all the subtotals using the techniques you posted. but there's one thing more i'd like to do. i'd like to get the average of all the subtotals i've just summed up. or just divide the sum to the no. of group. how will i do this?

thanks a lot.

4. Registered User
Join Date
Apr 2011
Posts
10
Old stuff, but it came in handy

#### Posting Permissions

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