Summarizing database data
You can create two types of summaries. A grand summary summarizes data in all the visible records of the database. A subsummary summarizes data in a subset of records.
You must follow these steps, which are described below:
1 |
Define summary fields. |
2 |
Insert a summary part onto a layout and insert the summary fields. |
3 |
For subsummaries, sort the records by the field that you are grouping the records by. |
4 |
In Browse mode, switch to Page View to see the summarized data. |
Defining a summary field
A summary field contains summarized data (for example, the sum, average, standard deviation, and so on) for records in a database.
A typical summary field uses the SUM function, which adds a range of numbers represented by whatever is between the parentheses. For example, the formula =SUM('SalesTotal') adds the data in the SalesTotal field for each record in the summary or subsummary.
To define a summary field:
1 |
Choose Define Fields from the Layout menu. |
2 |
Type a name for the summary field, choose Summary from the Field Type pop-up menu, and click Create. |
3 |
Build a formula for your summary field by selecting fields, operators, and functions. |
4 |
Choose a display format from the "Format result as" pop-up menu. |
Inserting summary parts
Summary parts display summary information. If you define a summary field but don't insert a summary part onto a layout, you won't be able to see summarized data on that layout.
To insert a grand summary part onto a layout:
1 |
If you're not already in Layout mode, choose Layout from the Layout menu. |
2 |
Choose a layout from the Layout menu. |
3 |
Choose Insert Part from the Layout menu. |
4 |
To insert a grand summary part above the body part, select "Leading grand summary." To insert a grand summary part below the body part, select "Trailing grand summary." |
To insert a subsummary part onto a layout:
1 |
If you're not already in Layout mode, choose Layout from the Layout menu. |
2 |
Choose a layout from the Layout menu. |
3 |
Choose Insert Part from the Layout menu. |
4 |
Select "Sub-summary when sorted by." |
5 |
Select the field that you want to group the records by. |
|
For example, to subtotal sales amounts by region, select the Region field. When you sort the database by this field, AppleWorks calculates the subsummary field correctly. |
|
To start a new page when the subsummary appears, select "Page break before part" or "Page break after part." |
6 |
Specify whether the subsummary data should appear above or below each group of sorted records. |
Inserting summary fields
To insert a summary field into a layout:
1 |
If you're not already in Layout mode, choose Layout from the Layout menu. |
2 |
Choose Insert Field from the Layout menu. |
3 |
Select a summary field and click Insert. |
4 |
Drag the summary field and, if you like, its field name into the grand summary or subsummary part you inserted in the procedure above. |
Sorting records for a subsummary
When you use a subsummary part to summarize data on a layout, you must sort the records by the same field you chose when inserting the summary part, above, to display the summarized data correctly.
Tip: If you plan to create the same summary report again, create a named sort or report.
Viewing the summarized data
Related topics
|