Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

4.06 Summarizing Data

Summarizing Data

The purpose of grouping data is to make the report easier to read by creating categories that the detail records fit into. Within these categories you perform various summary functions on fields so that the user can get an overview of the information within the group without having to read all the data. Crystal Reports has a large variety of summary functions to display for a group. Examples of these summary functions are sub-totals, averages, and maximum values. Table 4-1 shows a complete list of the summary functions available.

Table 4-1. Summary functions for groups.

Function Description
Average Calculates the average value. (2)
Correlatio Calculates the correlation of two fields. (1) (2)
Coun Counts the number of detail records. Fields with NULL values are not included in the calculation. (3)
Covarianc Calculates the measure of the linear relation between paired variables. (1)
DistinctCoun Calculates the number of unique values for that field.
Maximu Finds the maximum value of all the fields.
Media Returns the middle value if all the fields were sorted. (1)
Minimu Finds the minimum value of all the fields.
Mod Returns the value with the most duplicates.
NthLarges Finds the largest value of all the fields with a ranking of N. For example, if N were 6, it would return the sixth largest value.
NthMostFrequen Finds the Nth ranking field with the most duplicate values. For example, if N were 6, it would return the value with the 6th most duplicates.
NthSmalles Finds the smallest value of all the fields with a ranking of N. For example, if N were 6, it would return the sixth smallest value.
Percentag Returns a percentage of the grand-total for the selected field. (2)
Percentil Returns the value for the specified percentile of the field. (2)
PopStandar Deviation
Calculates how much a field deviates from the mean value. (1) (2) SampleStandard
Deviatio Returns the sample standard deviation for the field. (1) (2)
SampleVariance Returns the sample variance for the field. (1) (2)
Su Returns the total of all the detail fields.(2)
WeightedAverag Returns the weighted average of all the detail fields. (2)

Chart Notes:

See a statistics book for more information.

Can only be used for numeric data.

NULL values can be included if you set them to return their default values. To do this, select the menu options Crystal Reports > Report > Report Options. Then check the box for converting NULL field values to their default.

To summarize a field within the groups, right-click on the field that you want to summarize and select Insert > Summary.



Figure 4-11. The Insert Subtotal dialog box.

Inserting a Grand Total displays a dialog box that lets you choose which function should be performed on the field. As the report is run, this function is calculated for each field and its total is displayed. After selecting the OK button, the grand total field is added in the Report Footer section and aligned directly below the original field.

Inserting a summary field brings up the dialog box in Figure 4-10. The top dropdown box lets you select which field to summarize. The next dropdown box sets which calculation to perform on the field. After that, you can select which group to put this summary into, or you can put it in the report footer as a grand total. If you want to insert the summary field into a group that you haven’t created yet, you can click the Insert Group button.

By default, the summary field is automatically placed in the footer section. You can move this field to the group header by dragging and dropping it in design mode. This summary field has the same value, but now it prints before the detail records are printed.

You also have the option of showing the summary value as a percentage or summarize it across the hierarchy.

To change the summary function after it has been created, right-click on the summary field and select Change Summary Operation. That brings up a dialog box which lets you change the field to summarize and the summary calculation. Select the one you want to change and click on the OK button.