This document shows how to use a report control's Expression property to calculate a group summary, as shown in the image below:
This topic assumes that the UserDesignerOptions.DataBindingMode property is set to DataBindingMode.Expressions (the default value) or DataBindingMode.ExpressionsAdvanced.
Refer to Calculate a Summary in the Shape Data (Legacy Data Bindings) section for the legacy approach.
See Data Binding Modes for information on available binding modes.
Follow the steps below to calculate a summary:
Create a report bound to the sample Northwind database's Products table (the nwind.mdb file is included in the XtraReports installation).
Use the Group and Sort Panel to group report data by the CategoryName data field and construct a layout like the following:
Right-click the report's Detail band and select Insert Band / Group Footer from the context menu.
Drop an XRLabel control onto the Group Footer band.
Click the label's smart tag, then click the Summary field's ellipsis button to open the Summary Editor form.
In the Summary Editor form, use the following options:
See the Expression Constants, Operators, and Functions topic for a complete list of supported summary functions.
You can use the FormatString property to format the summary value:
Switch to Print Preview mode to see the result: