MicroStrategy ONE

WeightedStDev (Weighted Standard Deviation of a Sample)

The standard deviation is an indicator of how widely values in a group differ from the mean (see StDev (Standard Deviation of a Sample)). It is useful for comparing different sets of values with a similar mean.

A weighted standard deviation allows you to apply a weight, or relative significance to each value in a set of values. Values with a higher value for their weight are considered as more significant to a sample as compared to the other values in a sample.

WeightedStDev returns the weighted standard deviation of a population based on a sample. This is a group-value function.

Syntax

WeightedStDev <Distinct, FactID>(Argument, Weight)

Where:

  • Argument is an attribute, fact, or metric representing a list of numbers.
  • Weight is an attribute, fact, or metric representing a list of numbers to define the weight of each value.
  • FactID is a parameter that forces a calculation to take place on a fact table that contains the selected fact.

Expression

Where:

  • wi: The weight of the ith value. Values with a higher value for their weight are considered as more significant to a sample as compared to the other values in a sample.
  • N': The number of weights that are not equal to zero.
  • xw: The weighted mean of the values.

Usage Notes

Example

This example shows a report where the standard deviation and a weighted standard deviation of the revenue are 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 is based on the revenue values for each state within a region and calculated at the region level.

The report contains the attributes Customer Region and Customer State, and the metrics Revenue, Standard Deviation, and Weighted Standard Deviation.

The definition of the standard deviation metrics are as follows:

  • Standard Deviation:

    StDev(Revenue){[Customer Region], ~}

  • Weighted Standard Deviation:

    WeightedStDev(Revenue, Revenue) {[Customer Region] , ~ }

For this example, the revenue values are also used as the weights given to each revenue value included in the standard deviation.

The report is shown below:

The weighted standard deviation also takes into account the weights of each revenue value. For example, since Connecticut's revenue is greater than Maine's revenue, and the weight in this example is the revenue value, Connecticut's revenue is given more significance in the weighted standard deviation calculation. This results in $957,689 for the standard deviation as compared to $1,141,237 for the weighted standard deviation of Northeast revenue.

Notice that while the standard deviation and weighted standard deviation are applicable to a Customer Region in this example, the values are displayed for every Customer State row. One way to simplify the display of this information is to include this data on a dashboard. You can include the standard deviation and weighted standard deviation results in text fields along with additional visualizations of the data, as shown below.