## Key

• This line was removed.
• Formatting was changed.

D toc

Excerpt

Computes the variance among all values in a column. Input column can be of Integer or Decimal. If no numeric values are detected in the input column, the function returns `0`

The variance of a set of values attempts to measure the spread in values around the mean. A variance of zero means that all values are the same, and a small variance means that the values are closely bunched together. A high value for variance indicates that the numbers are spread out widely. Variance is always a positive value.

Var(X) = [Sum ((X - mean(X))2)] / Count(X)

If a row contains a missing or null value, it is not factored into the calculation.

D s terms
area stat_sampling

• This function is calculated across the entire population.

• For more information on a sampled version of this function, see VARSAMP Function.

The square root of variance is standard deviation, which is used to measure variance under the assumption of a bell curve distribution. See STDEV Function.

For a version of this function computed over a rolling window of rows, see ROLLINGVAR Function.

D s lang vs sql

D s
snippet Basic

D lang syntax
RawWrangle true ref true pivot value:var(myRating) group:postal_code limit:1

var(myRating)

Output: Returns the variance of the group of values from the `myRating` column.

D s
snippet Syntax

D lang syntax
RawWrangle true syntax true pivot value:var(function_col_ref) [group:group_col_ref] [limit:limit_count]

var(function_col_ref) [group:group_col_ref] [limit:limit_count]

ArgumentRequired?Data TypeDescription
function_col_refYstringName of column to which to apply the function

For more information on the `group` and `limit` parameters, see Pivot Transform.

D s lang notes

### function_col_ref

Name of the column the values of which you want to calculate the variance. Column must contain Integer or Decimal values.

• Literal values are not supported as inputs.
• Multiple columns and wildcards are not supported.

D s
snippet usage

Required?Data TypeExample Value
YesString (column reference)`myValues`

D s
snippet Examples

Include Page
 EXAMPLE - Statistical Functions EXAMPLE - Statistical Functions

D s also
label aggregate