MEDIAN() OVER ...

All functions > WINDOW FUNCTION > MEDIAN() OVER ...

Returns the median of values in the window frame as DOUBLE.

Syntax

MEDIAN(expr) OVER ([PARTITION BY expr [, ...]] [ORDER BY sort_item [, ...]] [ROWS|RANGE|GROUPS frame])

Notes

  • SQL translation is implemented only when the current SQL backend is DuckDB
  • Requires a well-defined window (ORDER BY, and optionally PARTITION BY and frame)
  • NULL values are ignored where the underlying window aggregate skips NULLs

See also

Examples

FeatureQL
SELECT
    f1 := ZIP(ARRAY[1,2,3] AS id, ARRAY[10e0, 20e0, 30e0] AS v).TRANSFORM(SELECT MEDIAN(v) OVER (ORDER BY id ASC)).UNWRAP() -- Running median to the current row
;
Result
f1 ARRAY
[10.0, 15.0, 20.0]

Last update at: 2026/05/26 17:22:09