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

# ETL: Rank Transformation

> Use the Rank component to sort input data by one or more fields, in an ascending or descending order and add a rank field that reflects the sort order.

<Frame>
  <img src="https://mintcdn.com/integrateio/OwEKdS5aIKsEcmhX/images/creating-packages/using-components-rank-transformation/image-1.png?fit=max&auto=format&n=OwEKdS5aIKsEcmhX&q=85&s=0462d98444ee0dd999258fbe1b0286fc" alt="Rank component configuration panel" width="1200" height="828" data-path="images/creating-packages/using-components-rank-transformation/image-1.png" />
</Frame>

## Add rank field

Choose a name for the rank field (default is `rank`). Existing field names can't be used in the input components as field names must be unique.<img src="https://mintcdn.com/integrateio/OwEKdS5aIKsEcmhX/images/creating-packages/using-components-rank-transformation/image-2.png?fit=max&auto=format&n=OwEKdS5aIKsEcmhX&q=85&s=8d07a3265c9e7ed323dfbbb7b476e738" alt="Rank field name and dense rank checkbox settings" width="1200" height="828" data-path="images/creating-packages/using-components-rank-transformation/image-2.png" />

Check **Use dense rank** in order to remove gaps in ranking values. By default, when multiple records have the same values in the sort keys (a "tie"), they will have the same rank value and there will be a gap between them and the next record's rank value. To avoid the gap, use `dense rank option.`  For example,

| **sorted field** | **rank** | **dense rank** |
| :--------------- | :------- | :------------- |
| 'a'              | 1        | 1              |
| 'a'              | 1        | 1              |
| 'b'              | 3        | 2              |

* **Checked use dense rank**
  <Frame>
    <img src="https://mintcdn.com/integrateio/OwEKdS5aIKsEcmhX/images/creating-packages/using-components-rank-transformation/image-3.png?fit=max&auto=format&n=OwEKdS5aIKsEcmhX&q=85&s=f1605f7c1935078c0084d9d6a5ac4a95" alt="Rank output with dense rank enabled, no gaps in values" width="1200" height="828" data-path="images/creating-packages/using-components-rank-transformation/image-3.png" />
  </Frame>
* **Unchecked use dense rank**
  <Frame>
    <img src="https://mintcdn.com/integrateio/OwEKdS5aIKsEcmhX/images/creating-packages/using-components-rank-transformation/image-4.png?fit=max&auto=format&n=OwEKdS5aIKsEcmhX&q=85&s=2cbc186cfbb57dd82320bfe5bb7989d3" alt="Rank output without dense rank, showing gaps in values" width="1200" height="828" data-path="images/creating-packages/using-components-rank-transformation/image-4.png" />
  </Frame>

## Data Order

You can either `add rank without sorting the data` to add arbitrary rank value without sorting the input data, or `rank data by fields order` by selecting fields and sort direction (ascending or descending) to sort the data by.
