Skip to main content

variance

Returns the variance value for a set of numbers.

Tip

If you want to calculate the variance between two measures (e.g. Sales vs. Target), or for one measure over two time periods, see the groupByVarianceTable function.

In statistics, variance measures the amount of variability among numbers in a dataset. Specifically, it calculates the average squared difference of a data point from the mean of the data. If the variance value is large, it means the data is spread out away from the mean. If the value is small, it means the data is concentrated near the mean.

There are two types of variance:

Type

Assumption

Sample variance

The data is a sample representing a larger population

Population variance

The data is a population of its own

The second parameter specifies which type to calculate. Sample variance is the default.

The third parameter controls how the function handles null/empty values.

Parameters

  • INPUT LIST (list or table region)

    A list or table region of numbers.

  • IS SAMPLE (Boolean)

    Optional. Whether to calculate sample variance (true) or population variance (false).

    Default: true

  • IGNORE NULLS (Boolean)

    Optional. Whether to ignore empty/null values (true) or count them as zero (false).

    Default: true

Examples

ATL in Script

Result

Notes

[[variance((1,2,3,4,5))]]

2.5

Calculates sample variance.

[[variance((1,2,3,4,5), false)]]

2

Calculates population variance.

HANDLING NULL OR EMPTY VALUES

Assume a "Describe the Table" project with this data:

Candidate_ID

Score

Row 1

19001

77

Row 2

19002

65

Row 3

19003

53

Row 4

19004

Row 5

19005

67

The first parameter can take a column variable, but here the Score column has one empty value. The optional third parameter tells the function to ignore the null/empty values or count them as zeros. For example.

ATL in Script

Result

Notes

[[variance(Score, '', '')]]

97

The IGNORE NULLS parameter is unspecified, so true applies by default. The empty value is ignored.

[[variance(Score, '', false)]]

930.8

The IGNORE NULLS parameter is set to false. The empty value in the Score column is counted as zero.

Important

In a "Describe Row in Context" project, you would use ScoreColumn for the input variable.