MSum (Moving Sum) Function

Table 134. MSum (Moving Sum) Function 

Field

Description

Description

Computes the moving sum of a column using the current row and the preceding n-1 row.

Syntax:

MSum(value_expression, width, sort_expression_list)

value_expression

The value expression represents a scalar numeric column expression for which a moving average is to be computed. The expression cannot contain any OLAP or aggregate functions.

width

The width represents the number of previous rows to be used in computing the moving average. The width value is always a positive integer constant. The maximum width is 4096.

sort_expression_list

The sort_expression_list is a list of expressions (with optional sort direction specifications) separated by commas. That is, it specifies the column references used to sort the values. The default sort direction is ascending (ASC).