# MV_MEDIAN_ABSOLUTE_DEVIATION

Converts a multivalued field into a single-valued field containing the median absolute deviation. The median absolute deviation is calculated as the median of each data point’s deviation from the median of the entire sample. For a random variable `X`, it is defined as `median(|median(X) - X|)`.

## Syntax

`MV_MEDIAN_ABSOLUTE_DEVIATION(number)`

### Parameters

#### `number`

A multivalue expression.

## Examples

Calculating the median absolute deviation and median

```esql
ROW values = [0, 2, 5, 6]
| EVAL median_absolute_deviation = MV_MEDIAN_ABSOLUTE_DEVIATION(values), median = MV_MEDIAN(values)
```

This example calculates the median absolute deviation and the median for the multivalued field `values`.

## Notes

- If the field contains an even number of values, the medians are calculated as the average of the middle two values.
- If the values are not floating-point numbers, the averages are rounded towards 0.
