> 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 formula 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.

![Table grouped by state showing county, Population 2010, and RowNumber columns, with RowNumber restarting at 1 for each state and increasing with ascending population.](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/sigma.docs.buildwithfern.com/adbdd020447da4e85819db1670dc950a285dfea6d29bdd0a7c1302a207a152e7/assets/docs-images/5686f73-image.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260914%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260914T205817Z&X-Amz-Expires=604800&X-Amz-Signature=d5d9e5f64cda5e4f7f78a33c0c6f98d06e5d3f7cff72fe5759754b3d08cb69b9&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

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

![Table listing states sorted ascending by COUNTY - Count, with Rank, RankDense, RankPercentile, and RowNumber columns. Tied COUNTY - Count values, like Hawaii and Rhode Island at 5, share the same Rank and RankDense but get consecutive RowNumber values.](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/sigma.docs.buildwithfern.com/6e5583cf1e9c583f7804e1077e0ba97e4295e142510bb53ecdedacafa194353d/assets/docs-images/9517408-image.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260914%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260914T205817Z&X-Amz-Expires=604800&X-Amz-Signature=a13ad7c34bc784b0751c24e18b7817deaa2fd681a1daebe4424a3ed1328f0448&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

In this example, review the differences between the different ranking functions.

## Related resources

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