Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[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]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
   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]Aggregation
     [Expand]Summaries
     [Collapse]Totals
       Totals Overview
       Grand Totals
       Custom Totals
       Running Totals
      Aggregation Levels
     Grouping
    [Expand]Sorting
    [Expand]Filtering
    [Expand]Data Formatting
   [Expand]Data Analysis
   [Expand]Layout
   [Expand]Printing and Exporting
   [Expand]Appearance
   [Expand]MVVM Enhancements
   [Expand]Miscellaneous
   [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]Diagram Control
  [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]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 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.

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 Pivot Grid doesn't provide a collection of automatic totals. The custom totals can be accessed via the 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 PivotGridField.CustomTotals collection.
Summary type The type of summary function used to calculate an automatic total, is determined by the corresponding data field's PivotGridField.SummaryType property. The type of summary function used to calculate a custom total is specified by the custom total object (specifically by its PivotGridCustomTotal.SummaryType property).

Expanded Creating and Displaying Custom Totals

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

Custom totals (like 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 Display Custom Totals

Show Me

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

The following example demonstrates how to add custom totals for a particular pivot grid field.

In this example, four different totals are added for the Category Name row field: Average, Sum, Min and Max. For this, they should be added to the PivotGridField.CustomTotals property and the PivotGridField.TotalsVisibility property should be set to FieldTotalsVisibility.CustomTotals.

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