MicroStrategy ONE

MovingMin (Moving Minimum)

Compares the current value and preceding values as defined in the function arguments to calculate a moving minimum value. The calculation can be restarted based on attributes set in the function parameters. This is an OLAP function.

Syntax

MovingMin <BreakBy,SortBy>(Argument, WindowSize)

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.
  • WindowSize is a positive integer indicating the number of values to use in each calculation.

Expression

Where:

  • yi = metric value at the ith row
  • m = window size
  • n = number of rows/metric values

Example

This simple example illustrates how the MovingMin function moves through a list of values returning the lowest value within a specified number of values. In this case, the window size is set to 3, meaning that the value in the MovingMinimum column represents the lowest value among the current and preceding two values in the value list. The calculation is shown in the following table.

Values MovingMinimum

550

550

30

30 (30<550)

40

30 (30<40 and 30<550)

70

30 (30<70 and 30<40)

50

40 (40<70 and 40<50)