
The automatic totals are calculated using a summary function the corresponding Data Field specifies.
The table below lists the common members that configure automatic totals:
Use custom totals to calculate totals using a different summary function, or to calculate multiple subtotals.
You may need to manually specify how many and what type of totals to display for each field. The custom totals replace automatic totals and can be calculated using various aggregation functions like Sum, Min, Max, Average, etc. The number of totals depends on how many items you add to the field's custom total collection.
For example, the image below shows the Category field displaying Sum and Max totals:

The code below creates the layout as in the image above:
C# |
using DevExpress.Xpf.PivotGrid;
PivotGridField field = pivotGridControl1.Fields["CategoryName"];
pivotGridControl1.BeginUpdate();
try {
field.CustomTotals.Clear();
field.CustomTotals.Add(FieldSummaryType.Sum);
field.CustomTotals.Add(FieldSummaryType.Max);
field.TotalsVisibility = FieldTotalsVisibility.CustomTotals;
}
finally {
pivotGridControl1.EndUpdate();
}
|
VB |
Imports using DevExpress.Xpf.PivotGrid
Dim field As PivotGridField = pivotGridControl1.Fields("CategoryName")
pivotGridControl1.BeginUpdate()
Try
field.CustomTotals.Clear()
field.CustomTotals.Add(FieldSummaryType.Sum)
field.CustomTotals.Add(FieldSummaryType.Max)
field.TotalsVisibility = FieldTotalsVisibility.CustomTotals
Finally
pivotGridControl1.EndUpdate()
End Try
|
You can set the same layout in XAML as well:
XAML |
<dxpg:PivotGridControl x:Name="pivotGridControl1" DataSource="{Binding Data, Source={StaticResource TypedSimpleSource}}">
<dxpg:PivotGridControl.Fields>
<dxpg:PivotGridField Area="RowArea" Caption="Category" FieldName="CategoryName"
AreaIndex="0" TotalsVisibility="CustomTotals">
<dxpg:PivotGridField.CustomTotals>
<dxpg:PivotGridCustomTotal SummaryType="Sum" />
<dxpg:PivotGridCustomTotal SummaryType="Max" />
</dxpg:PivotGridField.CustomTotals>
</dxpg:PivotGridField>
<dxpg:PivotGridField Area="ColumnArea" FieldName="Country" AreaIndex="0"/>
<dxpg:PivotGridField Area="DataArea" FieldName="Extended Price" AreaIndex="0" Caption="Total Sum"/>
<dxpg:PivotGridField Area="RowArea" Caption="Product" FieldName="ProductName" AreaIndex="1"/>
</dxpg:PivotGridControl.Fields>
</dxpg:PivotGridControl>
|
The following table lists the members you can use to configure custom totals:
Running totals allow you to calculate cumulative values that correspond to the specified column or row fields. For instance, in the PivotGridControl below, running totals are enabled for the Quarter field:

In the result, the PivotGrid control in the image below displays cumulative sales for each quarter over a two-year period:

Note that cumulative values depend on the values' order. End-users can change the order using Sorting, Grouping or filtering.
You can specify whether running totals are calculated independently within individual groups, or for the entire PivotGrid. In the image below, running totals for the Quarter field are calculated independently for each year (cross-group variation is disabled):

The table below lists the members you can use to configure running totals: