Weighted medians are a helpful statistical tool to measure the central tendency of a multi-part data set. If the weight of each component of the data set is equal, then the median is the same as the weighted median.

This function is created using BigQuery’s UDF capabilities.