Sorting, grouping, and totaling report data
You can use SAP Crystal Reports to sort, group, and total data in a report.
Sorting means arranging data in an order to help you find and evaluate it. When you sort, SAP Crystal Reports prompts you to specify the field you want the sort to be based on (sort field) and the sort direction.
Sort direction refers to the order in which the values are displayed, once sorted.
- Ascending order means smallest to largest (1 to 9, A to Z, False to True).
- Descending order means largest to smallest (9 to 1, Z to A, True to False).
This example shows you how to sort the Employee report by the employee’s last name.
- In the SAP Crystal Reports main menu, select Report > Sort Records.
- In the Record Sort Order window on the Report Fields list, double-click hrpersnl.p_lname to move it to the Sort Fields list.
- For Sort Direction, select either ascending or descending.
- Click .
Grouped data is data that is divided into meaningful groups.
This example shows you how to group the Employee Original Hire Date List report by the benefit plan description.
- In the SAP Crystal Reports main menu, select Insert/Group.
- In the Insert Group window, select hbeplan.desc from the first drop-down list.
-
Click
.The report adds a Group Header #1 section and the field Group #1 Name.
Summaries enable you to calculate averages, counts, and other group values.
This example shows you how to display the number of employees in each group.
- Click once to highlight the p_lname field (not the column heading).
- In the SAP Crystal Reports main menu, select Insert > Summary.
- In the Insert Summary window, select Count from the first drop-down list.
-
Click
.The numeric field is inserted in the Group Footer #1 area.
- To the left of the Summary field, insert a text object called Employee Count.
Use the Subtotal menu item to insert a subtotal of the currently selected numeric field into your report.
This example shows you how to add a subtotal to each groups' benefit premium.
- Click once to highlight the p_epremium field (not the column heading).
- In the SAP Crystal Reports main menu, select Insert > Subtotal.
-
In the Insert Subtotal window, click .
The numeric field is inserted in the Group Footer #1 area.
- To the left of the Subtotal field, insert a text object called Subtotal.
Use the Grand Total menu item to include a report grand total of the currently selected numeric field at the end of the report.
This example shows you how to add a grand total to the report.
- Click once to highlight the p_epremium field (not the column heading).
- In the SAP Crystal Reports main menu, select Insert > Grand Total.
- In the Insert Grand Total window, select Sum from the first drop-down list.
-
Click
.The numeric field is inserted in the Report Footer area.
- To the left of the Grand Total field, insert a text object called Grand Total.
- In the main menu, select File > Print Preview and go to the last page of your report to see the result.