[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [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
       Drill Down to the Underlying Data
      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]Gantt Control
  [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

This example demonstrates how to calculate a custom summary to display the distinct value count.

When the control calculates the summary value for the field whose SummaryType (see PivotGridFieldBase.SummaryType) is PivotSummaryType.Custom, the PivotGridControl.CustomSummary event occurs. The event handler calls the PivotGridCustomSummaryEventArgsBase<T>.CreateDrillDownDataSource method to retrieve the underlying data rows for the current cell, counts distinct values and returns the result to the PivotGridCustomSummaryEventArgsBase<T>.CustomValue property.


The complete sample project How to Create a Custom Summary Type to Display the Distinct Value Count is available in the DevExpress Examples repository.


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

Expanded See Also

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