Returns the actual value at the nearest percentile without interpolation.
Same as input expressionDiperbarui: 13 Jun 2026PERCENTILE_DISC(expression, percentile) OVER ([PARTITION BY partition_expression])Column that can be sorted
Percentile value between 0 and 1
Divides data into groups
1 SELECT 2 department, 3 name, 4 salary, 5 PERCENTILE_DISC(salary, 0.5) OVER (PARTITION BY department) as median_salary 6 FROM `project.dataset.employees`;
Median that returns an actual salary value from the dataset.
| department | name | salary | median_salary |
|---|---|---|---|
| Sales | David | 50000 | 80000 |
| Sales | Bob | 80000 | 80000 |
| Sales | Alice | 120000 | 80000 |
1 SELECT DISTINCT 2 category, 3 PERCENTILE_DISC(price, 0.5) OVER (PARTITION BY category) as median_disc, 4 PERCENTILE_CONT(price, 0.5) OVER (PARTITION BY category) as median_cont 5 FROM `project.dataset.products`;
Comparison of DISC (actual value) vs CONT (interpolated value).
Sudah paham PERCENTILE_DISC? Latih langsung di browser
Latihan interaktif, langsung di browser.