[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)

Window Calculation Functions

You can use the WindowExpressionBindingBase.Expression property to compose an expression that uses window calculation functions, as illustrated in the following code snippet:

The resulting grid looks as shown below:

Refer to How to create Window Calculations for details.

The following table lists functions you can use to compose an expression for the WindowExpressionBinding data binding instance's Expression property:

Function

Description

Example

Last()

Returns the number of rows from the current row to the last row in the window.

Last()

First()

Returns the number of rows from the current row to the first row in the window.

First()

Index()

Returns the index of the current row in the window.

Index()

Size()

Returns the number of rows in the window.

Size()

Lookup(SummaryExpression, Position)

Returns the value of the expression in a target position specified as a relative offset from the current position.

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

RankCompetition(SummaryExpression, [ 'asc' | 'desc' ])

Returns the standard competition rank for the current row in the window.

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

RankDense(SummaryExpression, [ 'asc' | 'desc' ])

Returns the dense rank for the current row in the window.

RankDense(Sum([Amount]), 'asc')

RankUnique(SummaryExpression, [ 'asc' | 'desc' ])

Returns the unique rank for the current row in the window.

RankUnique(Sum([Amount]), 'asc')

RankModified(SummaryExpression, [ 'asc' | 'desc' ])

Returns the modified competition rank for the current row in the window.

RankModified(Sum([Amount]), 'asc')

RankPercentile(SummaryExpression, [ 'asc' | 'desc' ])

Returns the percentile rank for the current row in the window.

RankPercentile(Sum([Amount]), 'asc')

RunningAvg(SummaryExpression)

Returns the running average of the specified expression from the first row in the window to the current row.

RunningAvg(Sum([Amount]))

RunningCount(SummaryExpression)

Returns the running count of the specified expression from the first row in the window to the current row.

RunningCount(Sum([Amount]))

RunningMax(SummaryExpression)

Returns the running maximum of the specified expression from the first row in the window to the current row.

RunningMax(Sum([Amount]))

RunningMin(SummaryExpression)

Returns the running minimum of the specified expression from the first row in the window to the current row.

RunningMin(Sum([Amount]))

RunningSum(SummaryExpression)

Returns the running sum of the specified expression from the first row in the window to the current row.

RunningSum(Sum([Amount]))

WindowAvg(SummaryExpression, StartOffset, EndOffset)

Returns the average of the expression within the window, which is defined using offsets from the current row.

WindowAvg(Sum([Amount]), First(), Last())

WindowCount(SummaryExpression, StartOffset, EndOffset)

Returns the count of the expression within the window.

WindowCount(Sum([Amount]), First()+2, Last())

WindowCountDistinct(SummaryExpression, StartOffset, EndOffset)

Returns the distinct count of the expression within the window.

WindowCountDistinct(Sum([Amount]), First(), Last())

WindowMax(SummaryExpression, StartOffset, EndOffset)

Returns the maximum of the expression within the window.

WindowMax(Sum([Amount]), First(), Last())

WindowMin(SummaryExpression, StartOffset, EndOffset)

Returns the minimum of the expression within the window.

WindowMin(Sum([Amount]), First(), Last())

WindowMode(SummaryExpression, StartOffset, EndOffset)

Returns the statistical mode in the window (the element that occurs most often in the values calculated with the specified expression within the window).

WindowMode(Sum([Amount]), First(), Last())

WindowMedian(SummaryExpression, StartOffset, EndOffset)

Returns the median of the expression within the window.

WindowMedian(Sum([Amount]), First(), Last())

WindowSum(SummaryExpression, StartOffset, EndOffset)

Returns the sum of the expression within the window.

WindowSum(Sum([Amount]), First()+2, Last())

WindowVar(SummaryExpression, StartOffset, EndOffset)

Returns the variance of the expression within the window.

WindowVar(Sum([Amount]), First(), Last())

WindowVarp(SummaryExpression, StartOffset, EndOffset)

Returns the biased variance of the expression within the window.

WindowVarp(Sum([Amount]), First(), Last())

WindowStdDev(SummaryExpression, StartOffset, EndOffset)

Returns the sample standard deviation of the expression within the window.

WindowStdDev(Sum([Amount]), First(), Last())

WindowStdDevp(SummaryExpression, StartOffset, EndOffset)

Returns the biased standard deviation of the expression within the window.

WindowStdDevp(Sum([Amount]), First(), Last())

Total(SummaryExpression)

Returns the total for the specified expression in a calculation window.

Total(Sum([Amount]))

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