Skip to main content
A newer version of this page is available. .
Tag

PivotGridFieldBase.RunningTotal Property

Gets or sets whether Running totals are calculated for values in the Data Area that correspond to the current column or row field.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.PivotGrid.v19.2.Core.dll

Declaration

[DefaultValue(false)]
public bool RunningTotal { get; set; }

Property Value

Type Default Description
Boolean **false**

true to calculate Running totals for the current column/row field; otherwise, false.

Remarks

If the RunningTotal property is set to true, total values depend upon the order of values. End-users can change that order by sorting, grouping or filtering.

When filtering is applied, running totals do not include the values that have been filtered out.

Use the PivotGridOptionsData.AllowCrossGroupVariation property to specify whether running totals are calculated independently within individual groups, or throughout the Pivot Grid.

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

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RunningTotal.DefaultForm" %>

<%@ Register Assembly="DevExpress.Web.ASPxPivotGrid.v19.2, Version=19.2.15.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4"
    Namespace="DevExpress.Web.ASPxPivotGrid" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v19.2, Version=19.2.15.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4"
    Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table class="OptionsTable BottomMargin">
            <tr>
                <td>
                    <dx:ASPxCheckBox ID="cbRunningTotals" runat="server" Text="Include Previous Quarter Sales into the Values of the Next Quarter"
                        Checked="True" AutoPostBack="True" />
                    <dx:ASPxCheckBox ID="cbAllowCrossGroupRunningTotals" runat="server" Text="Allow Cross-Group Running Totals Accumulation"
                        Checked="False" AutoPostBack="True" />
                </td>
            </tr>
        </table>
        <dx:ASPxPivotGrid ID="ASPxPivotGrid1" runat="server" DataSourceID="NwindDataSource"
            CssClass="" Width="100%">
            <OptionsView ShowFilterHeaders="False" ShowColumnTotals="False" />
            <Fields>
                <dx:PivotGridField Area="RowArea" AreaIndex="0" FieldName="ProductName" ID="fieldProductName"
                    Caption="Product" />
                <dx:PivotGridField Area="ColumnArea" AreaIndex="0" FieldName="OrderDate" ID="fieldOrderDate"
                    Caption="Year" GroupInterval="DateYear" />
                <dx:PivotGridField Area="ColumnArea" AreaIndex="1" FieldName="OrderDate" Caption="Quarter"
                    GroupInterval="DateQuarter" ID="fieldQuarter" ValueFormat-FormatString="Qtr {0}"
                    ValueFormat-FormatType="Numeric" />
                <dx:PivotGridField Area="DataArea" AreaIndex="0" FieldName="ProductAmount" ID="fieldProductAmount"
                    Caption="Product Sales" />
            </Fields>
            <OptionsView HorizontalScrollBarMode="Auto" />
            <OptionsFilter NativeCheckBoxes="False" />
        </dx:ASPxPivotGrid>
        <asp:AccessDataSource ID="NwindDataSource" runat="server" DataFile="~/App_Data/nwind.mdb"
            SelectCommand="SELECT * FROM [CustomerReports]"></asp:AccessDataSource>
    </div>
    </form>
</body>
</html>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RunningTotal property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also