---
title: "percent_rank window function in Strata | Oplema"
description: "Express a row's rank on a scale from 0 to 1, for percentile-style comparisons within a window. Use it in a Strata Formula with an OVER clause."
url: "https://oplema.com/docs/strata/functions/percent-rank"
updated: "2026-11-04"
---

# percent\_rank

Express a row rank on a scale from zero to one.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **DOUBLE**.

Example input

1. Row 1 `id = 1, amount = 10`
2. Row 2 `id = 2, amount = NULL`
3. Row 3 `id = 3, amount = 30`
4. Row 4 `id = 4, amount = 30`

### Expression

```
percent_rank() OVER (ORDER BY amount)
```

### Result

```
Row 1: 0.0
Row 2: 1.0
Row 3: 0.3333333333333333
Row 4: 0.3333333333333333
```

NULL means the value is missing.

Try it live in Formula

Result
| id | amount | result |
| --- | --- | --- |
| 1 | 10 | 0 |
| 3 | 30 | 0.3333 |
| 4 | 30 | 0.3333 |
| 2 |  | 1 |

## Arguments and types

```
percent_rank([ORDER BY ordering])
```

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.

## Related functions

[dense\_rank

Rank distinct values consecutively, giving ties the same rank.

](https://oplema.com/docs/strata/functions/dense-rank)[lag

Compare each row with a value from an earlier row.

](https://oplema.com/docs/strata/functions/lag)[lead

Compare each row with a value from a later row.

](https://oplema.com/docs/strata/functions/lead)[rank

Rank values while leaving gaps after ties.

](https://oplema.com/docs/strata/functions/rank)

[Browse across rows](https://oplema.com/docs/strata/functions#across-rows) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/window_functions.html#percent_rankorder-by-ordering)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
