Table 133. MDiff (Moving Difference) Function
Field | Description |
---|---|
Description | Returns the moving difference between the current row-column value and the preceding nth value. The moving difference is a common business metric used to compare activity for some variable in a current time period to the activity for the same variable in another time period at a fixed distance in the past. |
Syntax: | MDiff(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). |