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

# Repeat

The **Repeat** function returns a string created by repeating a given string a specified number of times.

**Repeat** is one of the [Text functions](/docs/type-functions) supported by Sigma.

## Syntax

```
Repeat(string, number)
```

Repeat has the following arguments:

<dl>
  <dt>
    string
  </dt>

  <dd>
    Required
  </dd>

  <dd>
    The string that the function repeats
  </dd>

  <dt>
    number
  </dt>

  <dd>
    Required
  </dd>

  <dd>
    The number of times the string repeats.
  </dd>

  <dd>
    The zero, 

    <code>0</code>

    , and negative values both return a 

    <code>NULL</code>

     string.
  </dd>
</dl>

## Examples

The following table shows the output of using **Repeat** on the *Product Type* column.

![A table showing the Product Type column alongside the output of the Repeat function for the number values 0, 1, 2, 3, and -1](https://sigma-docs-screenshots.s3.us-west-2.amazonaws.com/img/function-repeat-example.png)

```
Repeat([Product Type], 0)
```

Returns an empty string as the  **Product Type** is repeated zero times.

```
Repeat([Product Type], 1)
```

Returns each **Product Type** value unchanged.

```
Repeat([Product Type], 2)
```

Returns each **Product Type** value repeated twice.

```
Repeat([Product Type], 3)
```

Returns each **Product Type** value repeated three times.

```
Repeat([Product Type], -1)
```

Returns an empty string.

You can also use **Repeat** to add leading zeros to a fixed-length value. For example, to format invoice IDs as eight-digit numbers with leading zeros:

```
Concat(Repeat("0", 8 - Len([Invoice ID])), [Invoice ID])
```

`Len([Invoice ID])` evaluates how many zeros are needed to reach a total length of 8 characters. **Repeat** is used to create the required number of zeros. [**Concat**](**doc:concat) joins the zeros to the front of the invoice ID, producing the final fixed-length value. As a result, an example ID of `12345` returns `00012345`, and an example ID of `1234` returns `00001234`.

## Related resources

* [Contains](/docs/contains)
* [Substring](/docs/substring)