> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# nth_greatest()

<span id="atoti.array.nth_greatest" />

> atoti.array.nth\_greatest(<br />
>     *measure*: VariableMeasureConvertible,<br />
>     /,<br />
>     *n*: PositiveInt | VariableMeasureConvertible,<br />
> ) → MeasureDefinition

Return a measure equal to the *n*-th greatest element of the passed array measure.

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> pnl_table = session.read_csv(
...     TEST_RESOURCES_PATH / "csv" / "pnl.csv",
...     array_separator=";",
...     keys={"Continent", "Country"},
...     table_name="PnL",
... )
>>> cube = session.create_cube(pnl_table)
>>> l, m = cube.levels, cube.measures
>>> m["3rd greatest"] = tt.array.nth_greatest(m["PnL.SUM"], n=3)
>>> cube.query(m["PnL.SUM"], m["3rd greatest"])
                          PnL.SUM 3rd greatest
0  doubleVector[10]{-20.163, ...}         -.53
```

### Parameters

<h4 id="atoti.array.nth_greatest.measure">
  *measure*
</h4>

> VariableMeasureConvertible

<h4 id="atoti.array.nth_greatest.n">
  *n*
</h4>

> PositiveInt | VariableMeasureConvertible
