> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# RowNumber

> Use the Sigma RowNumber function to number the rows in the table using the input column.

Number the rows in the table using the input column. Begins with 1.

## Syntax

```
RowNumber(column, direction)
```

Function arguments:

<dl>
  <dt>
    column
  </dt>

  <dd>
    (optional) The column used to order the table. The input column can be numbers, dates or text.
  </dd>

  <dt>
    direction
  </dt>

  <dd>
    (optional) The direction to sort the input column. Default is to sort ascending.
  </dd>
</dl>

Each row is numbered according to the input column’s ordering, without taking into account duplicate values.  For example, if the input includes “Anne”, “Jane”, “Jane” and “Pari”, the values would be ranked 1, 2, 3 and 4.

## Example

```
RowNumber([Population 2010], "asc")
```

This assigns the smallest population 1, the second smallest 2 and so on with each population being assigned the next number in the sequence even when the values are identical.

![](https://files.buildwithfern.com/sigma.docs.buildwithfern.com/adbdd020447da4e85819db1670dc950a285dfea6d29bdd0a7c1302a207a152e7/assets/docs-images/5686f73-image.png)

```
RowNumber([COUNTY - Count])
```

![](https://files.buildwithfern.com/sigma.docs.buildwithfern.com/6e5583cf1e9c583f7804e1077e0ba97e4295e142510bb53ecdedacafa194353d/assets/docs-images/9517408-image.png)

## Related resources

* [Rank](/docs/rank)
* [RankDense](/docs/rankdense)
* [RankPercentile](/docs/rankpercentile)