Log In
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]HTML Editor
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Collapse]Data Shaping
       Automatic totals
       Custom Totals
       Grand Totals
       Running Totals
      Aggregation Levels
   [Expand]Data Analysis
   [Expand]Data Formatting
   [Expand]Data Export
   [Expand]Design-Time Features
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[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]Report Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Custom Totals

Automatic totals are calculated using a summary function which is specified by the corresponding data field. Custom totals can be calculated using any summary function. It is possible to calculate multiple custom totals against a data field.

The following image shows a sample Pivot Grid control which displays Automatic Totals:

In the following image, the same ASPxPivotGrid is shown with Custom Totals enabled for the Category Name field. The custom totals replace the automatic totals for this field.

The main differences between Automatic and Custom Totals are listed in the following table:

Feature Automatic Totals Custom Totals
Association with fields Automatic totals are not associated with fields. They are calculated for all the field values which have nested field values. Custom totals are associated with column or row fields. They are only calculated for the values of associated fields, provided that these values have nested field values. Custom totals replace automatic totals for these field values.
Collection of total objects The ASPxPivotGrid doesn't provide a collection of automatic totals. The custom total collection can be accessed via the corresponding field's PivotGridField.CustomTotals property.
Number of Totals for individual field values The number of automatic totals displayed for a specific field value matches the number of data fields. The number of custom totals displayed for a specific field value is determined by the number of items in the field's custom total collection.
Summary type The type of summary function used to calculate an automatic total is determined by the corresponding data field's PivotGridFieldBase.SummaryType property. The type of summary function used to calculate a custom total is specified by the custom total object (specifically by its PivotGridCustomTotalBase.SummaryType property).

Expanded Displaying Custom Totals

Custom totals are represented by PivotGridCustomTotal objects, and are stored within a field's PivotGridField.CustomTotals collection. To display custom totals for a specific column/row field, do the following:

Custom totals (as well as automatic totals) are calculated for field values which have nested field values. They are not calculated for the values of the innermost column and row fields. If a field is not a column field or row field, custom totals are not calculated for it.

Expanded Example: How to Add Custom Totals

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1868.

This example shows how to display custom totals in the 'Country' column field. Four custom totals calculate the Average, Sum, Min and Max values against the data field.

Expanded See Also

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