PERCENTILE
computes a specified percentile of the values of an attribute for all records in the group.
PERCENTILE
function is:
PERCENTILE(<attribute>, <numeric_literal>)where:
mdex:long
or mdex:double
.Note that if the percentile falls between two values, then EQL computes a weighted average. As an example, suppose there are only two values, 10 and 20. If you ask for the 20th percentile, then the result will be 12, because 12 is 20% of the way from 10 to 20.
PERCENTILE
ignores rows in which its first argument is NULL. If the first argument is NULL for all rows in a group, PERCENTILE
returns NULL for that group.
PERCENTILE examples
In both examples, SalesAmount is a single-assign double attribute.
RETURN Results AS SELECT PERCENTILE(SalesAmount, 90) AS x90 FROM SalesState GROUP
x90 ---------- | 571.18 | ----------
RETURN Results AS SELECT PERCENTILE(SalesAmount, 25) AS x25, PERCENTILE(SalesAmount, 50) AS x50, PERCENTILE(SalesAmount, 75) AS x75 GROUP
x25 x50 x75 ----------------------------- | 180.225 | 236.5 | 445.675 | -----------------------------