MicroStrategy ONE

Last

The Last function returns the last value in a sorted set of values. It is often used to define subtotals, as shown in the example below. This is a group-value function.

Syntax

Last<FactID, SortBy>(Argument)

Where:

  • Argument is an attribute, fact, or metric representing a list of values.
  • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact.
  • SortBy is a parameter that allows you to define the attribute or metric on which to sort the data.

Example

In this example, Last is used in the subtotal for the metric End on Hand, returning the total items on hand in the last quarter of 2003. The subtotal expression is defined as follows:

Last<SortBy= (Day, Month, Quarter, Year) >(End on Hand) {@ }

For detailed instructions on creating and applying user-defined subtotals, see the MicroStrategy Advanced Reporting Guide.