[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Collapse]Cross-Platform Core Libraries
  Core Library Assemblies
 [Expand]DevExpress Data Library
 [Collapse]DevExpress Pivot Grid Core Library
   Pivot Grid Expression Syntax
   Optimized Calculation Engine
   Aggr Function
  [Collapse]Window Calculations
    Window Calculations Overview
    Partitioning Criteria
    Creating Window Calculations
    Window Calculation Functions
 [Expand]Miscellaneous
 [Expand]API Reference
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Creating Window Calculations

Follow the steps below to create a PivotGrid field that uses a window function to calculate its data.

  1. Switch to the Optimized Mode.
  2. Create a PivotGridField instance and specify the field's caption, location, name, and format.
  3. Create a data binding class instance.

    You can choose a predefined binding class instance:

    WinForms WPF ASP.NET Description
    RunningTotalBinding RunningTotalBinding RunningTotalBinding A cumulative total for the specified source binding across a window.
    MovingCalculationBinding MovingCalculationBinding MovingCalculationBinding Uses neighbouring values to calculate a total.
    DifferenceBinding DifferenceBinding DifferenceBinding Calculates the difference between values across a window.
    PercentOfTotalBinding PercentOfTotalBinding PercentOfTotalBinding A percentage of the total for the specified source binding across a window.
    RankBinding RankBinding RankBinding Assigns a rank to each row in a window.

    You can also use the WindowExpressionBinding type to specify a custom string as an expression that uses window functions:

    WinForms WPF ASP.NET Description
    WindowExpressionBinding WindowExpressionBinding WindowExpressionBinding A custom calculation with window functions.
  4. Specify the Partitioning Criteria to define a window and the calculation direction (see CalculationDirection) for certain calculation types.

  5. Assign the data binding instance to the PivotGridFieldBase.DataBinding property.
  6. Add the field to the PivotGridControl.Fields collection.
Note

The complete sample project is available in the DevExpress Demo Center: Code Examples - Optimized Mode - Field Calculation Bindings module in the XtraPivotGrid MainDemo .

Expanded See Also

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