Explore this snippet with some demo data here.
BigQuery does not have an explicit MEDIAN
function. The following snippet will show you how to calculate the median of any column.
Use the following snippet to create your median function in the BigQuery console:
PERCENTILE_CONT(<COLUMN>, 0.5) OVER() as median
Use the MEDIAN
syntax in a query like:
SELECT
PERCENTILE_CONT(<COLUMN>, 0.5) OVER() as median
FROM
<PROJECT.SCHEMA.TABLE>
median |
---|
1358146.5 |