MicroStrategy ONE

LastInRange

Returns the last value in a range of values. LastInRange can be used to examine data such as inventory at the end of each month.

Calculations can be restarted based on attributes set in the function parameters. This restart capability differentiates LastInRange from Last. While Last is a group-value function and takes both facts and metrics as argument input, LastInRange is an OLAP function and takes only metrics as argument input.

Syntax

LastInRange <BreakBy={}, SortBy=()> (Argument)

Where:

  • BreakBy is the attribute indicating where the calculation restarts.
  • SortBy is the attribute or metric by which the data is sorted.
  • Argument is a metric representing a list of numbers.

Expression

Where:

  • k = row number
  • yk = last non-NULL value of the metric after applying the BreakBy and SortBy parameters