Back to Devexpress

Window Calculations Overview

corelibraries-401364-devexpress-pivot-grid-core-library-advanced-analytics-window-calculations-window-calculations-overview.md

latest5.4 KB
Original Source

Window Calculations Overview

  • Oct 25, 2021
  • 2 minutes to read

Window calculations use window functions to calculate data across a set of window rows related to the current row. Partitioning criteria are applied to rows to arrange them in windows.

Note

Window calculations are available for the Optimized calculation engine. Use the PivotGridOptionsData.DataProcessingEngine property to enable the Optimized engine.

The following calculation types are supported:

Running Total

Allows you to calculate a cumulative total for a set of measure values.

Expression

RunningSum(Sum([Sales]))

Field Data Binding

BindingPartitioningParameters
RunningTotalBindingBaseColumnValueSummaryType = Sum
RunningTotalBindingColumnValueSummaryType = Sum

Moving Calculation

Allows you to apply a moving calculation, which uses neighboring values to calculate a total. Note that neighboring values are specified using offsets from the currently processed value.

Expression

WindowSum(Sum([Sales]), -1, 1)

Field Data Binding

BindingPartitioningParameters
MovingCalculationBindingBaseColumnValueSummaryType = Sum, prevCount = 1, nextCount = 1
MovingCalculationBindingColumnValueSummaryType = Sum, previousValuesCount = 1, nextValuesCount = 1

Difference

Allows you to compute differences between measure values.

Expression

Sum([Sales]) - Lookup(Sum([Sales]), -1)

Field Data Binding

BindingPartitioningParameters
DifferenceBindingBaseColumnValueTarget = Previous , DifferenceType = Absolute
DifferenceBindingColumnValueTarget = Previous, DifferenceType = Absolute

Percent of Total

Allows you to calculate a contribution of individual measure values to a total.

Expression

Sum([Sales]) / Total(Sum([Sales]))

Field Data Binding

BindingPartitioningParameters
PercentOfTotalBindingBaseColumnValue
PercentOfTotalBindingColumnValue

Rank

Allows you to rank values of the specified measure.

Expression

RankCompetition(Sum([Sales]), 'asc')

Field Data Binding

BindingPartitioningParameters
RankBindingBaseColumnValueRankType = Competition, Order = Ascending
RankBindingColumnValueRankType = Competition, Order = Ascending

See Also

Partitioning Criteria

Creating Window Calculations

Window Calculation Functions