How to: Calculate Cumulative Values in the Pivot Grid Control

  • 2 minutes to read

This example demonstrates how to include previous cell values in values of the next cell. To calculate cumulative values, set the PivotGridField.RunningTotal property of the corresponding field to true.

The PivotGridControl.AllowCrossGroupVariation property allows you to specify whether running totals are calculated independently within individual groups or for the entire Pivot Grid.

In this example, you can use the corresponding check boxes to control the Pivot Grid behavior.


Imports System.Windows
Imports DevExpress.Xpf.Editors

Namespace exWpfPivotRunningTotals
    Partial Public Class MainWindow
        Inherits Window

        Public Sub New()
        End Sub

        Private Sub ceRunningTotals_EditValueChanged(ByVal sender As Object,
                                                     ByVal e As EditValueChangedEventArgs)
            fieldOrderQuarter.RunningTotal = CBool(ceRunningTotals.IsChecked)
        End Sub

        Private Sub ceAllowCrossGroupRunningTotals_EditValueChanged(ByVal sender As Object,
                                                    ByVal e As EditValueChangedEventArgs)
            pivot.AllowCrossGroupVariation = CBool(ceAllowCrossGroupRunningTotals.IsChecked)
        End Sub
    End Class
End Namespace