Identify rows at or above a cumulative threshold.

Section: Distribution functions

Find the 90th-percentile style cutoff

sql
sql
WITH scored AS (
  SELECT salary,
         CUME_DIST() OVER (ORDER BY salary) AS cd
  FROM employees
)
SELECT *
FROM scored
WHERE cd >= 0.90;
Explanation

This is an intuitive pattern when exact percentile functions are unavailable or vary by dialect.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Distribution functions
Create deciles with NTILE(10)
Bucket rows into 10 groups.
OpenIn sheetsqlsame section
Leaderboard percent rank
Relative standing from 0 to 1.
OpenIn sheetsqlsame section
Flag top quartile customers
Turn NTILE output into a simple segment label.
Build labeled score bands
Assign named score ranges using a window bucket.