[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Fundamentals
   [Expand]Binding to Data
   [Collapse]Data Shaping
    [Collapse]Summarization
     [Collapse]Summaries
       Summaries Overview
       Automatic Summaries
       Custom Summaries
      [Expand]Summary Display Modes
       Accessing Cell Values
       Obtaining Underlying Data (Drill-Down)
      Totals
      Aggregation Levels
     Grouping
    [Expand]Sorting
    [Expand]Filtering
    [Expand]Editing
     Data Formatting
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Focus and Navigation
   [Expand]Printing and Exporting
   [Expand]Appearance
   [Expand]Design-time Features
   [Expand]Miscellaneous
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Examples
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [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]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[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.

Note

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

Note

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

Expanded See Also

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