MicroStrategy ONE

MovingStDev (Moving Standard Deviation)

Returns the moving standard deviation based on a list of values that is a sample of the population. The calculation can be restarted based on attributes set in the function parameters. This is an OLAP function.

Syntax

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

Expression

Where:

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

Example

This example shows a report where the moving standard deviation of the revenue is calculated. This calculation is based on the assumption that the list of values supplied in the metric represents a sample of the data for which you want to obtain the standard deviation. The calculation starts over for each region, the information is sorted within the region by state in ascending order, and each calculation is based upon a window size of 3.

Compare this example report to the example for MovingStDevP to see the different values returned when calculating for a population as opposed to a sample.

The report contains the attributes Customer Region and Customer State, and the metrics Total Revenue, MovingStDev, RunningStDev, and StDev. A report filter limits data to the Southwest, Southeast, and Northwest regions. The definition of the MovingStDev metric is as follows:

MovingStDev<BreakBy={[Customer Region]}, SortBy=<[Customer State])>([Total Revenue], 3)