dense_rank
Rank distinct values consecutively, giving ties the same rank.
Try an expression
In Formula, enter the expression and set Output type to BIGINT.
Example input
- Row 1
id = 1, amount = 10 - Row 2
id = 2, amount = NULL - Row 3
id = 3, amount = 30 - Row 4
id = 4, amount = 30
Expression
dense_rank() OVER (ORDER BY amount)Result
Row 1: 1
Row 2: 3
Row 3: 2
Row 4: 2NULL means the value is missing.
Arguments and types
dense_rank()The result type can depend on the input types. See DuckDB for the full argument rules.
Things to know
ORDER BY defines the order used by the calculation; it doesn't sort the output table. Include a unique tie-breaker when row position matters. Window expressions belong in Formula and can't be entered directly in Filter.
Function metadata from DuckDB, used under the MIT license.