MicroStrategy ONE
MovingStDevP (Moving Standard Deviation of a Population)
Returns the moving standard deviation of a population based on a list of values that encompasses the whole population. The calculation can be restarted based on attributes set in the function parameters. This is an OLAP function.
Syntax
MovingStDevP <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:
y
i
= metric value at the ith rowy
= average of metricm
= window sizen
= 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 the entire population 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 MovingStDev 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, MovingStDevP, RunningStDevP, and StDevP. A report filter limits data to the South, Southwest, and Northwest regions. The definition of the MovingStDevP metric is as follows:
MovingStDevP<BreakBy={[Customer Region]}, SortBy=<[Customer State])>([Total Revenue],3)