What Should be the Query ?

  • table has a field 'A' containing numeric value...

    Want a field 'B' to display to cumulative data of row 'A'

    where ,

    B1=A1, B2=B1+A2 , B3=B2+A3 .....

    Here 'B' is not a table field..

    it is just for display purpous on Report..

    ......................................................................................

    column 'A' has following values in desc order : 5,5,4,4,4,3,3,2,2,1

    So 'B' should have 5,10,14,18,22,25,28,30,32,33

    .......................................................................................

    i m working on Ms SQL server 2005 reporting services ..

  • From the SQL2005 BOL --> re: RS Aggregate Functions, look to RunningValue function.

    Returns a running aggregate of the specified expression.

    Syntax

    RunningValue(Expression, Function, Scope)

    Parameters

    Expression

    (Data type is determined by the aggregate function specified in Function.) The expression on which to perform the aggregation. The expression cannot contain aggregate functions.

    Function

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

    Scope

    (String) The name of a dataset, grouping, or data region that contains the report items to which to apply the aggregate function. If a dataset is specified, the running value is not reset throughout the entire dataset. If a grouping 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. For more information about the Scope parameter, see Aggregate Functions (Reporting Services).

    Return Type

    Determined by the aggregate function that is specified in the Function parameter.

    Remarks

    Restrictions for RunningValue are also determined by the aggregate function specified in the Function parameter. For more information, see the topic for the aggregate function that you are interested in using.

    Example

    The following code example provides a running sum of the cost field in the outermost data region.

    Copy Code

    RunningValue(Fields!Cost.Value, Sum, Nothing)

    Steve.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply