Back to Devexpress

Calculate a Running Summary

xtrareports-4816-feature-guide-to-devexpress-reports-shape-report-data-calculate-summaries-calculate-a-running-summary.md

latest4.0 KB
Original Source

Calculate a Running Summary

  • Feb 18, 2026
  • 4 minutes to read

This topic describes how to calculate a running summary across report groups. A running summary adds the current summary value to the previously calculated summaries.

The sample report shows current summaries by year for sales of the specified product:

View Example: Reporting for WinForms - How to Create a Report with Running Totals

Follow the steps in the sections below to create a sample report with a running summary.

Bind a Report to Data

  1. Add a new blank report to the project. Review the following help topic for details: Create a Report in Visual Studio.

  2. Click Add Report Data Source in the report’s smart tag to invoke the Data Source Wizard , as illustrated in the following image:

  3. Create a data source bound to the ProductReports view in the sample Northwind database.

  4. Filter report data to display only the specified product:

Add a Calculated Field to Calculate a Year Value

  1. Click Field List in the Visual Studio XtraReports menu to invoke the Field List panel. Right-click any field and select Add Calculated Field :

  2. Right-click the newly created field and select Edit Expression to invoke the Expression Editor dialog:

  3. Enter the following expression that calculates the year value for the ShippedDate data field:

  4. In the Properties window, rename the calculated field to calcYear. Alternatively, right-click the field in the Field List and select Edit Calculated Fields to invoke the Calculated Field Collection Editor where you can specify the field name.

Group Data by Year

  1. Use the Group and Sort panel to create a Group Header band associated with the CategoryName field. If the panel is hidden, click Group and Sort in the XtraReports menu:

  2. Select the Show Footer checkbox in the Group and Sort panel to add the Group Footer band:

Add Report Controls to Display Data

  1. Drop fields from the Field List window to report bands to create data-bound XRLabel controls that display data:

  2. Use the Format String editor in the label’s smart tag to specify how to display data.

  3. Right-click the report’s design area and select Insert Band - Report Header to add the Report Header band.

  4. Drop the ProductName field from the Field List window to the Report Header band to create a label. Use the label’s Format String editor to enter a string to display:

Add a Running Summary

  1. Drop the XRLabel control from the Toolbox to the Group Footer band. Click the ellipsis next to the Summary editor in the label’s smart tag to invoke the Summary Editor :

  2. In the Summary Editor dialog you should set the following options:

  3. The Summary Editor settings are automatically converted to an expression that is assigned to the label’s Expression property:

  4. You can click the ellipsis next to the Expression editor to invoke the Expression Editor dialog:

  5. Switch to the Preview tab to see the result.

See Also

Summaries Overview

Calculated Fields