Skip to content

median

relationalai.semantics.std.aggregates
median(*args: AggValue) -> Aggregate

Compute the median (50th percentile) of values, interpolating linearly between the two closest ranks.

Parameters

  • *args

    (AggValue, default: ()) - Values to compute the median over.

Returns

  • Aggregate - An Aggregate representing the computation of the median. Always returns Float.

Examples

Compute the median order amount:

select(aggregates.median(Order.amount))

Compute the median salary per department:

select(Department, aggregates.median(Employee.salary).per(Department))