Medians are a helpful statistical tool to measure the central tendency of a multi-part data set.

Median aggregations should be used to determine central tendency whenever a dataset contains outliers that would otherwise throw off the “average” of the data set. For example, medians are often used to determine the average age and average income of a given population.

This function is created using BigQuery’s UDF capabilities.