PERCENTILE_CONT: Calculating a Field Value Based on a Percentile
The PERCENTILE_CONT function calculates a field value based on a percentile.
Calculate a Field Value Based on a Percentile
PERCENTILE_CONT(percentile) WITHIN GROUP (ORDER BY field) OVER([PARTITION BY part1[, part2, ...]])
where:
percentile
Is a percentile value between 0 and 1.
field
Is the name of the input field or expression.
PARTITION BY part1, part2, ...
Are partitioning columns or expressions.
Calculating a Field Value Based on a Percentile
The following syntax returns the median Income.
PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY Income) OVER()
The following syntax returns Q3 of the Income field.
PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY Income) OVER()