Export (0) Print
Expand All

First Function (Reporting Services)

Returns the first value in the given scope of the specified expression.


First(expression, scope)

expression

(Variant or Binary) The expression on which to perform the aggregation, for example, =Fields!FieldName.Value. The expression cannot contain aggregate functions.

scope

(String) Optional. The name of a dataset, group, or data region that contains the report items to which to apply the aggregate function. If scope is not specified, the current scope is used. 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 type of expression.

The First function returns the first value in a set of data after all sorting and filtering have been applied at the specified scope.

The First function cannot be used in group filter expressions with anything except the current (default) scope.

You can also use First in a page header to return the first value from the ReportItems collection for a page in order to produce dictionary-style headings that display the first and last entries on a page.

The value of scope cannot be an expression and must refer to the current scope or a containing scope.

The following code example returns the first product number in the Category group of a data region:

=First(Fields!ProductNumber.Value, "Category")

Community Additions

ADD
Show:
© 2014 Microsoft