47
MicroStrategy Functions Reference
Standard Functions
2
© 2011 MicroStrategy, Inc.
Basic functions
117
Var (variance of a sample)
Variance is a measure of how spread out a set of values is. It is calculated as
the average squared deviation of each number from its mean.
This function calculates the variance based on a sample of a population. This
is a group-value function.
Syntax
Var <Distinct, FactID>(Argument)
Where:
• Argument is an attribute, fact, or metric representing a list of numbers.
• Distinct is a TRUE/FALSE parameter that allows you to calculate using
all values in the list or only the unique values.
• FactID is a parameter that forces a calculation to take place on a fact
table that contains the selected fact.
Expression
Usage notes
Assume when using this function that arguments constitute a population
sample, as opposed to a entire population.
Example
This example creates a report in which the variance of the units sold in the
subcategories within a category is calculated, with the assumption that the
data provided is a sample.
Compare this example report to the example for variance of a
population to see the different values returned when calculating for a
population as opposed to a sample.
The report includes the attributes Category and Subcategory, and the metrics
Units Sold and Var by Category. A report filter limits the categories displayed
to Books and Movies. The Var by Category metric is defined as follows:
n
x
2
∑
x
∑
(
)
2
–
n(n –1
)
-----------------------