Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 598 Bytes

median.md

File metadata and controls

28 lines (20 loc) · 598 Bytes

MEDIAN

Explore this snippet with some demo data here.

Description

BigQuery does not have an explicit MEDIAN function. The following snippet will show you how to calculate the median of any column.

Snippet ✂️

Use the following snippet to create your median function in the BigQuery console:

PERCENTILE_CONT(<COLUMN>, 0.5) OVER() as median

Usage

Use the MEDIAN syntax in a query like:

SELECT
  PERCENTILE_CONT(<COLUMN>, 0.5) OVER() as median
FROM
  <PROJECT.SCHEMA.TABLE>
median
1358146.5