[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Collapse]Data Shaping
       Summaries Overview
       Automatic Summaries
       Custom Summaries
      [Expand]Summary Display Modes
       Accessing Cell Values
       Obtaining Underlying Data (Drill-Down)
      Aggregation Levels
     Data Formatting
   [Expand]Data Analysis
   [Expand]Focus and Navigation
   [Expand]Printing and Exporting
   [Expand]Design-time Features
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Custom Summaries

The main idea of custom summaries is to give you the ability to calculate summaries manually. Custom summaries can be used to:

  • calculate a custom summary function;
  • involve multiple fields in summary calculation;
  • calculate a summary for specific records (for instance, for records that match a specific criteria).

To enable a custom summary for a specific data field, set the field's PivotGridFieldBase.SummaryType property to PivotSummaryType.Custom. Handle the PivotGridControl.CustomSummary event to implement a custom summary calculation routine. At runtime, the PivotGridControl.CustomSummary event will be fired in turn for each cell that corresponds to this data field.

While handling this event, you can call the PivotGridCustomSummaryEventArgsBase<T>.CreateDrillDownDataSource method to obtain a subset of data source records that correspond to the currently processed cell. In most cases, a custom summary will be calculated for these records.

Expanded Example: How to Calculate a Custom Summary

The following example shows how to calculate a custom summary.

Assume that the Pivot Grid Control is bound to a "SalesPerson" view. A field which displays the ratio of orders over $500 is to be added.

In this example, the custom summary is calculated against the "Extended Price" field. It's PivotGridCustomTotalBase.SummaryType property is set to PivotSummaryType.Custom and the caption to "Percentage of Orders over $500". The PivotGridControl.CustomSummary event is only handled to count those records whose total sum exceeds minSum. The ratio of these records to all the records is a custom summary value and therefore is assigned to the PivotGridCustomSummaryEventArgsBase<T>.CustomValue parameter.

The following image shows the result of the custom summary calculation:


Custom summaries calculated using the PivotGridControl.CustomSummary event are not supported in server mode.

Expanded See Also

Is this topic helpful?​​​​​​​