[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Collapse]Data Shaping
    [Collapse]Summarization
     [Collapse]Summaries
       Summary Overview
       Automatic Summaries
       Custom Summaries
      [Expand]Summary Display Modes
       Accessing Summary Values
       Drill Down to the Underlying Data
      Totals
      Aggregation Levels
     Grouping
    [Expand]Sorting
    [Expand]Filtering
    [Expand]Data Formatting
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Appearance
   [Expand]MVVM Enhancements
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[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

Custom summaries allow you to calculate summaries at your discretion. Custom summaries can do the following:

  • calculate a custom summary function;
  • involve multiple fields in summary calculation;
  • calculate a summary for records that match certain criteria.

Perform the following steps in Optimized mode:

The Pivot Grid control in Legacy and LegacyOptimized mode (before v19.2) can handle the PivotGridControl.CustomSummary event to implement a custom summary calculation routine. This approach can potentially degrade the performance.

Tip

In a custom summary calculation requires SELECT (to select from additional data sources) or JOIN operations, you can create a FederationDataSource and bind it to the Pivot Grid fields.

Expanded Example: How to Calculate Custom Summaries

This example demonstrates how to count distinct values (the number of orders with equal product quantities) and display the result in the pivot grid.

This example handles the PivotGridControl.CustomSummary event that occurs when the control calculates a summary for a field whose SummaryType (see PivotGridFieldBase.SummaryType) is PivotSummaryType. The event handler calls the PivotGridCustomSummaryEventArgsBase`1.CreateDrillDownDataSource method to retrieve the underlying data rows for the current cell, counts distinct values and returns the result to the PivotGridCustomSummaryEventArgsBase`1.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 and OLAP modes.

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