Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[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
  [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)
     [Expand]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]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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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:

Note

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

Expanded See Also

How would you rate this topic?​​​​​​​