Last Function (Reporting Services)

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

Syntax

Last(expression, scope)

Parameters

Return Type

Determined by the type of expression.

Remarks

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

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

You can also use Last in a page header to return the last 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.

Example

The following code example returns the last product number in the Category group of a data region.

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