# Perform operations with summary fields

This topic is 6107 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

• Newbies

Hi again, I'm sure this has been answered on here but the only thing I'm pretty sure of is that I need to change my summary fields to GetSummary fields...just not sure how to do it.

I'm making a gradebook sort of thing with a points field and a points possible field. (If I get 8 out of 10 on an assignment, 8 goes in the points field and 10 in the possible field.)

I made a report layout that categorizes the grades listing by class and so each class heading has a summary field that totals up the points and points possible from each class. Now I need a field that figures out the percentage of the subtotals. (If there are a total of 100 points in Math class, and I get 95 of those points, I need a field that calculates 95%)

I'm guessing I will change the summary fields to GetSummary (not sure how) and then make the percentage a calculation of GetSummary [points] / GetSummary [possible]

Thanks!

##### Share on other sites

Read very carefully the help on GetSummary() function. Calculation fields using GetSummary() do NOT replace summary fields - they USE summary fields.

##### Share on other sites

• Newbies

That's what I thought originally when I read this (and other things like it) on the forums:

[color:gray]

"You need to use the GetSummary() function in order to reference a sub-summary in a calculation." (I think you said it, comment.)

[color:gray]

Question:

I'm trying to figure out how to use division on summary fields in a subsummary part. Specifically:

The subsummary is sorted on the hour of the day. For each of the 24 hours, a total number of traffic accidents is displayed (summary field) and a total number of fatal accidents is displayed (also summary field). I need the report to display the percentage of fatal accidents each hour. Simply dividing the one summary field by the other results in a "?".

I assume there is a way to do this, but can't find it. Any help you could provide would hopefully bring this project to a merciful end.

You cannot calculate based on Summary fields (as you have probably noticed).

What you can do is this... instead of summary field(s), use calculated fields that use the GetSummary function. It will work exactly the same as the Summary fields, but will give you the ability to calculate off them.

Which made me think that you could not divide one summary field by another summary field. This, then, kind of made sense to me since when I originally tried it in my database, it somehow divided the TOTAL points (not individual subtotals) by the TOTAL points possible (not individual) and thus gave me the same percentage under each category instead of finding each individual category's percentage.

So OK, I need to use a getsummary function for the percentage field ,which will reference the two summary subtotal fields. Now what?

Again, sorry for my lack of knowledge on the matter -)

##### Share on other sites

If I am following correctly, you have two summary fields, one summing actual points and another possible points - let's call them sSumPoints and sSumPossible, respectively. And your layout has a sub-summary by Class part. In order to get the class ratio, you need a calculation field =

GetSummary ( sSumPoints ; Class ) / GetSummary ( sSumPossible ; Class )

Note that this field is tailor-made for the sub-summary by Class part - it will not work well when placed in any other layout part (unlike a summary field).

Another point worth noting is that the breakfield in GetSummary() cannot be a related field.

##### Share on other sites

• Newbies

Your calculation may be working correctly. Check your field number formatting. It will return a decimal and it is probably overflowing your text box.

##### Share on other sites

This topic is 6107 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account