# MEDIAN_ABSOLUTE_DEVIATION

The MEDIAN_ABSOLUTE_DEVIATION function calculates the median absolute deviation, a measure of variability. It is particularly useful for describing data that may have outliers or may not follow a normal distribution. In such cases, it can be more descriptive than standard deviation. The function computes the median of each data point’s deviation from the median of the entire sample.

## Syntax

`MEDIAN_ABSOLUTE_DEVIATION(number)`

### Parameters

#### number

The numeric expression for which the median absolute deviation is to be calculated.

## Examples

Calculate the median salary and the median absolute deviation of salaries:

```esql
FROM employees
| STATS MEDIAN(salary), MEDIAN_ABSOLUTE_DEVIATION(salary)
```

Calculate the median absolute deviation of the maximum values of a multivalued column:

```esql
FROM employees
| STATS m_a_d_max_salary_change = MEDIAN_ABSOLUTE_DEVIATION(MV_MAX(salary_change))
```

## Limitations

- The `MEDIAN_ABSOLUTE_DEVIATION` function is non-deterministic, which means you can get slightly different results using the same data.
- The `MEDIAN_ABSOLUTE_DEVIATION` function is usually approximate, which means the results may not be exact.
