# Rank

The Rank step allows you to order your data based on specific values, with options for different ranking methods. This is useful for identifying top performers, prioritizing items, or creating ordered lists within your dashboard.

### Steps parameters

* `Value column to rank` **column(string)\***: the value column that will be ordered to determine rank
* `Sort order` **dropdown\["asc", "desc"]\***: how to order the value column to determine ranking. Either `asc`(ending) or `desc`(ending), `desc` by default
* `Ranking method` **dropdown\["standard", "dense"]\***: either `standard` or `dense`, as explained above
* `Group ranking by` **column(array) (optional)**: if you need to apply the ranking computation by group of rows, you may specify here the columns to be used to constitute groups (see example 2 below)
* `New column name`**(string) (optional)**: if you want to give a custom name to the output column to be created (by default it will be your original column name suffixed by `_RANK`).

### Example

**Input**

<figure><img src="/files/HewL4JrDZKDbUPoKYdTY" alt=""><figcaption><p>Compute - Rank input</p></figcaption></figure>

**Configuration**

```json
{
    "value_col": "sales",
    "order": "standard",
    "method": "asc",
    "group_by": [],
    "new_column_name": "sales_rank_asc"
}
```

**Output**

<figure><img src="/files/c5rdmOoHPBoZuAiBsU2B" alt=""><figcaption><p>Compute - Rank output</p></figcaption></figure>

{% hint style="info" %}
There are 2 ranking methods available, that you will understand easily through those examples:

* `standard`: input = \[10, 20, 20, 20, 25, 25, 30] => ranking = \[1, 2, 2, 2, 5, 5, 6]
* `dense`: input = \[10, 20, 20, 20, 25, 25, 30] => ranking = \[1, 2, 2, 2, 3, 3, 4]

(The `dense` method is basically the same as the `standard` method, but rank always increases by 1 at most).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/preparing-data/overview-of-youprep-tm/compute/rank.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
