# `KURTOSIS`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Computes the unbiased excess kurtosis of input values. Excess kurtosis measures how heavy-tailed a distribution is relative to a normal distribution: positive values indicate heavier tails and more frequent outliers, negative values indicate lighter tails, and zero matches the normal distribution.

## Syntax

```sql
kurtosis(<expression>)
```

## Arguments

### Required

- `<expression>`: An expression of any numerical type.

## Returns

Returns a `double precision` value.

Returns NULL when fewer than four non-null input values are provided or when all non-null values are identical.

## Considerations

- Returns *excess* kurtosis (Fisher definition): a normal distribution has `KURTOSIS` of 0, not 3. Add 3 to convert to raw (Pearson) kurtosis.
- Uses an unbiased sample formula with finite-sample bias correction.
- Ignores NULL inputs. Any NaN or infinite input propagates to a NaN result.

## Examples

### Calculate Excess Kurtosis

Find the excess kurtosis of response times.

```sql
SELECT kurtosis(latency_ms) AS latency_kurtosis
FROM request_logs;
```

### Kurtosis by Group

Compute kurtosis for each endpoint to flag those whose latency has the heaviest tails.

```sql
SELECT endpoint, kurtosis(latency_ms) AS latency_kurtosis
FROM request_logs
GROUP BY endpoint
ORDER BY latency_kurtosis DESC;
```

### Summarize Distribution Shape

Report skewness and kurtosis side by side to summarize the shape of daily returns per ticker.

```sql
SELECT
    ticker,
    skewness_samp(return_pct) AS return_skew,
    kurtosis(return_pct)      AS return_kurtosis
FROM daily_returns
GROUP BY ticker;
```

## Related Documentation

- [SKEWNESS_POP](/docs/data/data-cloud-query-guide/references/dc-sql-reference/skewness-pop.md)
- [SKEWNESS_SAMP](/docs/data/data-cloud-query-guide/references/dc-sql-reference/skewness-samp.md)
- [STDDEV](/docs/data/data-cloud-query-guide/references/dc-sql-reference/stddev.md)
- [Aggregate Functions](/docs/data/data-cloud-query-guide/references/dc-sql-reference/aggregate.md)
