| title | row_rank_min() |
|---|---|
| description | Learn how to use the row_rank_min() function to return the current row's minimal rank in a serialized row set. |
| ms.reviewer | royo |
| ms.topic | reference |
| ms.date | 02/10/2026 |
[!INCLUDE applies] [!INCLUDE fabric] [!INCLUDE azure-data-explorer] [!INCLUDE monitor] [!INCLUDE sentinel]
Returns the current row's minimal rank in a serialized row set.
The rank is the minimal row number that the current row's Term appears in.
row_rank_min ( Term, [restart] )
[!INCLUDE syntax-conventions-note]
| Name | Type | Required | Description |
|---|---|---|---|
| Term | string |
✔️ | An expression indicating the value to consider for the rank. The rank is the minimal row number for Term. |
| restart | bool |
Indicates when the numbering is to be restarted to the StartingIndex value. The default is false. |
Returns the row rank of the current row as a value of type long.
The following query shows how to rank the Airline by the number of departures from the SEA Airport.
:::moniker range="azure-data-explorer"
[!div class="nextstepaction"] Run the query ::: moniker-end
datatable (Airport:string, Airline:string, Departures:long)
[
"SEA", "LH", 3,
"SEA", "LY", 100,
"SEA", "UA", 3,
"SEA", "BA", 2,
"SEA", "EL", 3
]
| sort by Departures asc
| extend Rank=row_rank_min(Departures)Output
| Airport | Airline | Departures | Rank |
|---|---|---|---|
| SEA | BA | 2 | 1 |
| SEA | LH | 3 | 2 |
| SEA | UA | 3 | 2 |
| SEA | EL | 3 | 2 |
| SEA | LY | 100 | 5 |
The following query shows how to calculate the rank of each Item partitioned by Category.
datatable(Category:string, Item:string, Value:int)
[
"A", "item1", 10,
"A","item2", 10,
"A", "item3", 5,
"A", "item4", 20,
"B", "item2", 5,
"B", "item1", 7
]
| sort by Category asc, Value asc
| extend rank = row_rank_min(Value, Category != prev(Category))Output
| Category | Item | Value | rank |
|---|---|---|---|
| A | item3 | 5 | 1 |
| A | item1 | 10 | 2 |
| A | item2 | 10 | 2 |
| A | item4 | 20 | 4 |
| B | item2 | 5 | 1 |
| B | item1 | 7 | 2 |