Median
AggregationDialect-gated
Median(column)
The 50th percentile (PERCENTILE_CONT(0.5) where the database supports it). Not available on MySQL, SQL Server, or BigQuery sources — SquareX fails loudly with SQX010 rather than approximating. The engine-by-engine landscape is the same as Percentile — see the support matrix there.
When to use it
Section titled “When to use it”- A typical value that outliers shouldn’t drag around — deal size, days-to-close, order value. Pair it with
Avgon the same chart; a gap between them is itself a finding.
Example
Section titled “Example”MedianOrderValue := Median(Sales.Amount)Under the hood
Section titled “Under the hood”MedianOrderValue := Median(Sales.Amount)-- PostgreSQL family: the ANSI ordered-set aggregateSELECT "Sales"."region", PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY "Sales"."amount") AS "MedianOrderValue"FROM "sales" AS "Sales"GROUP BY "Sales"."region"Good to know
Section titled “Good to know”- Non-additive — rejected under
YTD/RollingSum(SQX015).