Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

RunningValue Function (Report Builder 3.0 and SSRS)

Returns a running aggregate of all non-null numeric values specified by the expression, evaluated for the given scope.

NoteNote

You can create and modify report definitions (.rdl) in Report Builder 3.0 and in Report Designer in Business Intelligence Development Studio. Each authoring environment provides different ways to create, open, and save reports and related items. For more information, see Designing Reports in Report Designer and Report Builder 3.0 (SSRS) on the Web at microsoft.com.


RunningValue(expression, function, scope)
expression

The expression on which to perform the aggregation, for example, [Quantity].

function

(Enum) The name of the aggregate function to apply to the expression, for example, Sum. This function cannot be RunningValue, RowNumber, or Aggregate.

scope

(String) A string constant that is 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.

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.

RunningValue cannot be used in a filter or sort expression.

The set of data for which the running value is calculated 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.

Expression can contain calls to nested aggregate functions with the following exceptions and conditions:

  • Scope for nested aggregates must be the same as, or contained by, the scope of the outer aggregate. For all distinct scopes in the expression, one scope must be in a child relationship to all other scopes.

  • Scope for nested aggregates cannot be the name of a dataset.

  • Expression must not contain First, Last, Previous, or RunningValue functions.

  • Expression must not contain nested aggregates that specify recursive.

To calculate the running value of the number of rows, use RowNumber. For more information, see RowNumber Function (Report Builder 3.0 and SSRS).

For more information, see Aggregate Functions Reference (Report Builder 3.0 and SSRS) and Understanding Expression Scope for Totals, Aggregates, and Built-in Collections (Report Builder 3.0 and SSRS).

For more information about recursive aggregates, see Creating Recursive Hierarchy Groups (Report Builder 3.0 and and SSRS).

Description

The following code example provides a running sum of the field named Cost in the outermost scope, which is the dataset.

Code

=RunningValue(Fields!Cost.Value, Sum, Nothing)
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.