Skip to main content

Custom Summaries

  • 2 minutes to read

This article describes how to create custom summaries in Optimized and Server modes.

Use the PivotGridControl.CustomSummary event to create custom summaries in Legacy or LegacyOptimized mode.

Custom Summaries Overview

Pivot Grid allows you to calculate common summary functions for data fields. You can create custom summaries to execute complex calculations.

Custom summaries can do the following:

  • Use predefined and custom aggregate functions to calculate summary values.
  • Include multiple fields in a summary calculation.
  • Calculate a summary for records that match certain criteria.

Create a Custom Summary

Do the following to create a custom summary for a data field:

  1. Create a Pivot Grid field.
  2. Create an ExpressionDataBinding object, and specify a calculated summary expression in the object’s constructor.
  3. Assign the created ExpressionDataBinding object to the field’s DataBinding property.
  4. Add the field to the Data Area.

Refer to the following article for information on how to create calculated expressions: Bind Pivot Grid Fields to Calculated Expressions.


If a custom summary calculation requires data from multiple data sources, bind the Pivot Grid to a FederationDataSource that combines data from two or more tables into one data set. Then, the custom summary expression can use fields defined in the FederationDataSource.


The example below shows how create a Count Distinct field and bind it to an expression that contains a custom function. The expression counts distinct values (the number of orders with equal product quantities).

Pivot Grid Custom Summary

View Example: How to Create a Custom Summary to Display the Distinct Value Count

<dx:ThemedWindow x:Class="DXPivotGrid_CustomSummary.MainWindow" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800" 

        <dxpg:PivotGridControl Loaded="PivotGridControl1_Loaded" Name="pivotGridControl1" 
            <!-- ... -->
                <dxpg:PivotGridField Name="fieldQuantityDistinctCount"  Area="DataArea" AreaIndex="1" 
                     Caption="Count Distinct">
                        <dxpg:ExpressionDataBinding Expression="DistinctCount([OrderID])"/>


Refer to the following article for more information about custom functions: Custom Aggregate Functions.