GROUP AVERAGES IN REPORTS

To print a report which gives the line item total as a percentage
of a group, you must first do some prepocessing.

First, do a query which groups on your grouping field(s) by
placing a single check mark in that field(s). In the field you
are totalling enter the keywords CALC SUM ALL.  This will
produce an Answer table with one record per group and a total
field for that group.

Since you want to use this resulting Answer table as a Lookup
table for your report, the Anwer table must be keyed.  Use
{Modify} {Restructure} to Key the grouping field(s) by placing
an (*) asterisk next to the field type for that field(s).  F10/Do-it!
will save this change.

Now, within the report generator, while changing your original table,
use F10/Field/Lookup/Link to Link in the Answer table, linking on the
group field(s).

Because these tables are now linked, you can use the following
formula to give a line item value divided by group total:
use,   F10/Field/Place/Calculated  [plant]/[answer->group total].

For example:

Promotion table

PRMOTION Plant  Cost Ŀ
     1    a                 10.00   
     2    a                 20.00   
     3    b                  1.00   
     4    b                  2.00   
     5    b                  3.00   
     6    b                  4.00   
     7    c                  1.00   

With the above table use this query (was done withScripts/QuerySave)
Note: Only the Plant field has a check.

Query

 Prmotion | Plant  |     Cost                    |
          | Check  | calc sum all as Group Total |
          |        |                             |
          |        |                             |

Endquery
Do_it!

This will result in the following Answer table

ANSWER Plant  Group Total Ŀ
     1   a                    30.00   
     2   b                    10.00   
     3   c                     1.00   

You should restructure this to make Plant a Key field.

Then in your report for the promotion table, link Answer
as a Lookup and place the calculated field
          [Plant]/[Answer->Group Total]




These steps are needed because the Paradox report generator only
makes one pass through a table, adding values as it goes.  Itdoes
not know the total for a group until it has read the last record
in that group.

