List.StandardDeviation
ListReturns the sample standard deviation of the values in the list.
Syntax
List.StandardDeviation(numberList as list) as nullable numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
numberList | list | Yes | The list of numbers to compute the standard deviation for. |
Return Value
nullable number — The sample standard deviation of the numeric values in the list, or null if the list is empty.
Remarks
List.StandardDeviation computes the sample standard deviation of a numeric list, dividing by n - 1 (Bessel's correction) rather than n. This is the appropriate formula when the list represents a sample from a larger population, and it is the same calculation performed by Excel's STDEV.S function.
Standard deviation measures the average spread of values around the mean. A higher value indicates greater variability. A standard deviation of zero means all values are identical.
Returns null if the list is empty or contains only one element (sample standard deviation is undefined for fewer than two data points). Null values in the list are ignored — they are excluded from both the count and the calculation.
To compute the population standard deviation (dividing by n), there is no direct built-in function. One approach is Number.Sqrt(List.Average(List.Transform(values, each (_ - List.Average(values))^2))). For detecting outliers, a common heuristic is to flag values more than 2 or 3 standard deviations from the mean.
Examples
Example 1: Standard deviation of a simple list
List.StandardDeviation({2, 4, 4, 4, 5, 5, 7, 9})Result | |
|---|---|
| 1 | 2 |
Example 2: High variability vs. low variability
let
Consistent = List.StandardDeviation({10, 11, 10, 9, 10}),
Volatile = List.StandardDeviation({1, 50, 3, 98, 5})
in
#table({"Consistent StdDev", "Volatile StdDev"}, {{Consistent, Volatile}})The final output — a table comparing the standard deviations of the consistent and volatile lists side by side.
Consistent StdDev | Volatile StdDev | |
|---|---|---|
| 1 | 0.71 | 44.38 |
Example 3: Detect outliers using standard deviation
let
Values = {100, 105, 98, 102, 97, 200, 103},
Mean = List.Average(Values),
StdDev = List.StandardDeviation(Values),
Outliers = List.Select(Values, each Number.Abs(_ - Mean) > 2 * StdDev)
in
OutliersThe final output — a list containing only the outlier value 200.
Result | |
|---|---|
| 1 | {200} |