RunningValue Function (Reporting Services)
Returns a running aggregate of all non-null numeric values specified by the expression, evaluated for the given scope.
RunningValue(expression, function, scope)
The expression on which to perform the aggregation, for example, [Quantity]. This expression cannot contain aggregate functions.
(Enum) The name of the aggregate function to apply to the expression, for example, Sum. This function cannot be RunningValue, RowNumber, or Aggregate.
(String) The name of a dataset, data region, or group, or null (Nothing in Visual Basic), that specifies the context in which to evaluate the aggregation. Nothing specifies the outermost context, usually the report dataset. For more information, see Using Built-in Report and Aggregate Functions in Expressions (Reporting Services) and Calculating Totals and Other Aggregates (Reporting Services).
Determined by the aggregate function that is specified in the function parameter.
The value for RunningValue resets to 0 for each new instance of the scope. If a group is specified, the running value is reset when the group expression changes. If a data region is specified, the running value is reset for each new instance of the data region. If a dataset is specified, the running value is not reset throughout the entire dataset.
Restrictions for RunningValue are also determined by the aggregate function specified in the function parameter. RunningValue cannot be used in a filter or sort expression.
The set of data specified in the expression must have the same data type. To convert data that has multiple numeric data types to the same data type, use conversion functions like CInt, CDbl or CDec. For more information, see Type Conversion Functions.
Scope cannot be an expression.
To calculate the running value of the number of rows, use RowNumber. For more information, see RowNumber Function (Reporting Services).
The following code example provides a running sum of the field named Cost in the outermost scope, which is the dataset.
=RunningValue(Fields!Cost.Value, Sum, Nothing)