Downloads
DAXTextBeginner

REPT

Repeats a text value a set number of times.

Syntax
REPT(<text>, <num_times>)

Returns: Text (a scalar). Empty text when the count is zero.

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

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.

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:

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

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.

Related functions

All DAX functions · View as Markdown · DAX fundamentals