Finished Reports can calculate totals for each group and for the entire report.
- A group-level summary calculates a value separately for each group.
- A report-level summary calculates a value across the entire report.
In this example, the report is grouped by EmployeeID and displays group and report totals for Quantity, Total Cost, Discount Amount, and Discount Percentage.
Before You Begin
Before creating the calculations:
- Open the VDM View containing the required data.
- Click Run View to populate the data.
- Open Finished Reports Designer.
- Confirm that the report contains the required grouping.
For this example, the report is grouped by EmployeeID.
The report should contain:
- A Group Header for the grouping field
- A Group Footer for the group-level calculations
- A Report Footer for the report-level calculations
If the Group Footer is not displayed, use the Group and Sort panel to enable Show Footer for the group.
If the Report Footer is not displayed, right-click the report, select Insert Band, and then select Report Footer.
The report requires a Group Footer for group totals and a Report Footer for totals across the entire report.
Understanding the Summary Setting
A calculated label has a Summary setting that controls the scope of its calculation.
The available settings include:
- None — Calculates the expression for the current record.
- Group — Calculates the expression for the current group.
- Report — Calculates the expression across the entire report.
- Page — Calculates the expression for the current page.
For the calculations in this article, use Group or Report.
Create a Group-Level Total
Step 1: Add or Select a Label in the Group Footer
Add a label to the Group Footer, or select an existing label in that band.
Position the label under the corresponding report column.
For example, place a Quantity total under the Quantity column and a Total Cost total under the Total Cost column.
Step 2: Open Label Tasks
With the label selected, click its menu button to open Label Tasks.
The Label Tasks panel contains the following settings:
- Text
- Expression
- Format String
- Summary
Step 3: Enter the Group Summary Expression
Enter an aggregate expression for the required calculation.
Examples include:
| Calculation | Expression |
|---|---|
| Quantity | sumSum([Quantity]) |
| Total Cost | sumSum([TotalCost]) |
| Discount Amount | sumSum([DiscountAmount]) |
| Discount Percentage | sumSum([DiscountAmount]) / sumSum([TotalCost]) |
Use the Expression Editor when you need to create or modify a longer expression.
Important: For a calculated percentage, divide the summarized values. Do not add the individual percentage values together.
Step 4: Set the Summary to Group
In Label Tasks, set Summary to Group.
This causes the calculation to restart for each group in the report.
Set an appropriate Format String for the result. Examples include:
| Result | Example format string |
|---|---|
| Currency | {0:c2} |
| Percentage | {0:0.00%} |
Set Summary to Group when the calculation should be performed separately for each group.
Step 5: Configure a Group-Level Percentage
To calculate the discount percentage for each group, use:
sumSum([DiscountAmount]) / sumSum([TotalCost])
Set the Format String to:
{0:0.00%}
Set Summary to Group.
Calculate a group percentage by dividing the summarized Discount Amount by the summarized Total Cost.
Create a Report-Level Total
Step 1: Add or Select a Label in the Report Footer
Add a label to the Report Footer, or select an existing label in that band.
Position the label under the corresponding report column.
The Report Footer appears once at the end of the report, so these calculations represent totals across all report results.
Step 2: Configure the Report Summary
Open Label Tasks and configure the required expression.
The expressions can use the same aggregate functions as the group-level calculations:
| Calculation | Expression |
|---|---|
| Quantity | sumSum([Quantity]) |
| Total Cost | sumSum([TotalCost]) |
| Discount Amount | sumSum([DiscountAmount]) |
| Discount Percentage | sumSum([DiscountAmount]) / sumSum([TotalCost]) |
Set Summary to Report.
Set Summary to Report when the calculation should include all records in the report.
Step 3: Configure the Report-Level Percentage
For the overall discount percentage, use:
sumSum([DiscountAmount]) / sumSum([TotalCost])
Set the Format String to:
{0:0.00%}
Set Summary to Report.
The report-level percentage uses totals from the entire report.
Preview and Verify the Results
Select Preview after configuring the calculations.
Confirm that:
- Each group displays its own totals in the Group Footer.
- The group calculations restart for each group.
- The Report Footer appears once at the end of the report.
- The Report Footer values represent totals across all groups.
- Currency and percentage values use the expected formatting.
The completed report displays a separate calculation for each group and an overall calculation at the end of the report.
Group and Report Summary Comparison
| Setting | Calculation scope | Recommended location |
|---|---|---|
| Group | Current group only | Group Footer |
| Report | All report records | Report Footer |
The expression can be the same at both levels. The Summary setting determines whether the expression is calculated for the current group or the entire report.
Comments
0 comments
Please sign in to leave a comment.