<!-- https://learnsql.cpetoday.com/functions/dax/rept -->
# REPT

Language: DAX
Category: Text
Syntax: REPT(<text>, <num_times>)
Summary: Repeats a text value a set number of times.
Returns: Text (a scalar). Empty text when the count is zero.
Level: Beginner
Related: CONCATENATE, FORMAT, LEN, LEFT, CONCATENATEX, ROUND

## What it does
REPT repeats a piece of text a number of times. It is a simple way to show a bar made of characters inside a table cell, where a chart is not available, such as an email or a plain text export. The number of repeats is usually a rounded value, because text cannot repeat a fraction of a time.

## Syntax and arguments
- text: the text to repeat, such as a block character or a star.
- num_times: how many times to repeat it. A negative number is an error. Use ROUND to make it a whole number.

## Example
A plain text summary of margin by product category, shown in a memo, needs a quick visual cue. Each block represents 5 percent of margin.

```dax
Margin Bar =
REPT(
    "|",
    ROUND([Gross Margin %] * 20, 0)
)
```

A margin of 40 percent gives 8 bars, and 20 percent gives 4. The bar is a text stand-in for a chart, and it reads well in a copied table or an email.

## Example: a second, different use
Show a traffic-light score for a control check, with the number of stars equal to the score:

```dax
Control Score = REPT("*", [Checks Passed])
```

If five checks pass, the cell shows five stars. Keep the count small, because a long string is hard to read.

## Things to watch
- REPT is for display. The text cannot be summed or compared as a number.
- Use ROUND or INT on the count, because a fraction is not a valid repeat count.
- A count of zero returns empty text, so the cell looks blank.
- Long bars can wrap or overflow the cell. Keep the scale small.
- For a true visual, use a chart with conditional formatting. REPT is a fallback for text-only outputs.

## In business terms
REPT is a light way to make a text report easier to scan: a bar of budget use in a memo, stars for a rating in a summary, or a dot for each open item in a status list. It is a finishing touch, not an analysis tool.
