Skip to main content

Calculate a Summary

  • 2 minutes to read

This tutorial demonstrates how to obtain a total price within each detail report by calculating a summary for a data-bound label control using a built-in function.

report-server-calculate-summary-result

Do the following to accomplish this task:

  1. Select the detail report and add a Group Footer by switching to the Properties panel and clicking the Insert Group Footer Band button in the Actions category. This allows you to display a summary at the bottom of each detail report

    report-server-add-group-footer-band

    Ensure that the Group Footer band is correctly associated with an appropriate Group Header band using the Level property. For this tutorial, the Group Footer’s Level property should be set to 1 (as specified in the previous tutorial).

  2. Drop the Label control from the Toolbox onto the created Group Footer.

    report-server-group-footer-drop-field

  3. Select the newly created label and expand the Actions category in the Properties panel. In the Summary section, set the Running property to a value that specifies the range for which to calculate a summary (the entire report, a specific report group or document page). Then, click the Expression property’s ellipsis button, and in the invoked Expression Editor, select the required summary in the Functions | Summary section.

    report-server-control-summary-options

    The Format String property allows you to apply formatting to the summary result. For instance, use the Total: {0:c2} string to format a summary value as a currency and add a custom text before this value.

    You can also use the Ignore NULL values option to specify whether to consider null (empty) data source records when calculating the total. This property is aimed at functions like sumCount or sumAverage because the number of elements counted depends on the property value.

  4. Specify the summary label’s appearance settings (for instance, make the font bold). Use the Line controls to separate the field captions and summary value from the detail data.

    report-server-group-footer-sumary-layout

Click the Preview report-server-web-preview-button toolbar button to view the result.

report-server-calculate-summary-result

See Also