Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.

wpf-pivot-running-totals-example

Imports System.Windows
Imports DevExpress.Xpf.Editors

Namespace exWpfPivotRunningTotals
    Partial Public Class MainWindow
        Inherits Window

        Public Sub New()
            InitializeComponent()
        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