# variance\_pop

[Read this page in HTML](https://www.scopedb.io/docs/reference/functions/aggregate/variance_pop)

Returns the population variance of non-NULL values.

## Syntax

```scopeql
variance_pop(<expr>)
```

## Arguments

| Argument | Type                      | Description  |
| -------- | ------------------------- | ------------ |
| `<expr>` | `int`, `uint`, or `float` | Input value. |

## Returns

Returns `float`. Ignores NULL values. Returns NULL for no non-NULL values and `0.0` for one non-NULL value.

## Examples

Compare request latency across channels, treating these rows as all requests in the reporting period:

```scopeql
VALUES
    ('web', 100.0), ('web', 120.0), ('web', 140.0),
    ('mobile', 60.0), ('mobile', 120.0), ('mobile', 180.0)
SELECT $0 AS channel, $1 AS latency_ms
GROUP BY channel
AGGREGATE avg(latency_ms) AS avg_ms, variance_pop(latency_ms) AS variance_ms2
SELECT channel, avg_ms, round(variance_ms2 * 100.0) / 100.0 AS variance_ms2
ORDER BY channel
```

```text
+---------+--------+--------------+
| channel | avg_ms | variance_ms2 |
+---------+--------+--------------+
| mobile  | 120.0  | 2400.0       |
| web     | 120.0  | 266.67       |
+---------+--------+--------------+
```

Both channels have the same mean, but mobile durations are more spread out. The population variance is measured in ms²; results are rounded to two decimal places.
