Function Reference > Functions > STDDEV
  

STDDEV

Returns the standard deviation of the numeric values you pass to this function. STDDEV is used to analyze statistical data.
You can nest only one other aggregate function within STDDEV, and the nested function must return a numeric data type. You cannot nest aggregate functions in an elastic mapping.
Use only in mapping tasks.

Syntax

STDDEV( numeric_value [,filter_condition] )
Argument
Required/
Optional
Description
numeric_value
Required
Numeric data types. This function passes the values for which you want to calculate a standard deviation or the results of a function. You can enter any valid transformation expression. You can use operators to average values in different fields.
filter_condition
Optional
Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE, FALSE, or NULL. You can enter any valid transformation expression.

Return Value

Numeric value.
NULL if all values passed to the function are NULL or if no rows are selected (for example, the filter condition evaluates to FALSE or NULL for all rows).

Nulls

If a single value is NULL, STDDEV ignores it. However, if all values are NULL, STDDEV returns NULL.

Group By

STDDEV groups values based on group by fields you define in the transformation, returning one result for each group.
If there is no group by field, STDDEV treats all rows as one group, returning one value.

Examples

The following expression calculates the standard deviation of all rows greater than $2000.00 in the TOTAL_SALES field:
STDDEV( SALES, SALES > 2000.00 )
SALES
2198.0
1010.90
2256.0
153.88
3001.0
NULL
8953.0
RETURN VALUE: 3254.60361129688
The function does not include the values 1010.90 and 153.88 in the calculation because the filter_condition specifies sales greater than $2,000.
The following expression calculates the standard deviation of all rows in the SALES field:
STDDEV(SALES)
SALES
2198.0
2198.0
2198.0
2198.0
RETURN VALUE: 0
The return value is 0 because each row contains the same number (no standard deviation exists). If there is no standard deviation, the return value is 0.