DAX text functions: every one with an example

A reference of all DAX text functions, LEFT, RIGHT, MID, LEN, FIND, SEARCH, SUBSTITUTE, REPLACE, TRIM, UPPER, LOWER, REPT, EXACT, VALUE, FIXED, FORMAT, UNICHAR, UNICODE, CONCATENATE, CONCATENATEX and COMBINEVALUES, with examples and when to do text work in Power Query instead.

Short answer: DAX text functions cut, find, replace, convert and join text. Most work like their Excel namesakes: LEFT, RIGHT, MID and LEN cut, FIND (case-sensitive) and SEARCH (not case-sensitive, with wildcards) locate, SUBSTITUTE and REPLACE change, VALUE, FIXED and FORMAT convert, and CONCATENATE, &, CONCATENATEX and COMBINEVALUES join. Cleaning text columns is usually better done in Power Query, before the data reaches the model; in DAX, text functions shine in measures for labels and titles.

Which functions cut and measure text?

FunctionExampleResult
LEFT ( text, n )LEFT ( "PRD-2026-0042", 3 )PRD
RIGHT ( text, n )RIGHT ( "PRD-2026-0042", 4 )0042
MID ( text, start, n )MID ( "PRD-2026-0042", 5, 4 )2026
LEN ( text )LEN ( "PRD-2026-0042" )13
TRIM ( text )TRIM ( " a b " )a b
UPPER, LOWERLOWER ( "PRD" )prd
Cutting (on "PRD-2026-0042")

TRIM removes leading and trailing spaces and reduces inner runs to one space; Microsoft notes it trims the ordinary space character, not the nonbreaking space (UNICHAR 160).

Which functions find and replace?

FunctionExampleResult
FIND ( find, within [, start] [, notfound] )FIND ( "-", "PRD-2026-0042" )4
SEARCH ( find, within [, start] [, notfound] )SEARCH ( "prd*2026", "PRD-2026-0042" )1
SUBSTITUTE ( text, old, new [, instance] )SUBSTITUTE ( "PRD-2026-0042", "-", "/" )PRD/2026/0042
REPLACE ( text, start, n, new )REPLACE ( "PRD-2026-0042", 1, 3, "ITM" )ITM-2026-0042
EXACT ( a, b )EXACT ( "Prd", "PRD" )FALSE
Finding and replacing

Give FIND and SEARCH a not found value (FIND ( "x", T[Code], 1, 0 )): without it, a missing text is an error. FIND is case-sensitive and has no wildcards; SEARCH ignores case and supports ? and *.

-- text after the last dash: the number at the end
Code Number =
VAR T = Items[Code]
VAR Dashes = LEN ( T ) - LEN ( SUBSTITUTE ( T, "-", "" ) )
VAR Pos = FIND ( "|", SUBSTITUTE ( T, "-", "|", Dashes ), 1, 0 )
RETURN VALUE ( MID ( T, Pos + 1, LEN ( T ) ) )

Which functions convert?

FunctionExampleResult
VALUE ( text )VALUE ( "0042" )42
FIXED ( n [, decimals] [, no_commas] )FIXED ( 1234.567, 1 )1,234.6 (text)
FORMAT ( value, format )FORMAT ( 0.256, "0.0%" )25.6% (text)
REPT ( text, n )REPT ( "■", 4 )■■■■
UNICHAR ( code )UNICHAR ( 9650 )▲
UNICODE ( text )UNICODE ( "A" )65
Converting

REPT and UNICHAR make small text visuals in tables: a bar of blocks, or a coloured triangle with conditional formatting. In depth: FORMAT.

Trend Icon = IF ( [Revenue] >= [Revenue LY], UNICHAR ( 9650 ), UNICHAR ( 9660 ) )

Which functions join text?

FunctionExampleResult
&"Q" & 4 & " " & 2026Q4 2026
CONCATENATE ( a, b )CONCATENATE ( "Q", 4 )Q4
CONCATENATEX ( table, expr, delim )CONCATENATEX ( VALUES ( C[Country] ), C[Country], ", " )AT, DE
COMBINEVALUES ( delim, e1, e2, ... )COMBINEVALUES ( "|", T[Year], T[Store] )2026|S12
Joining

COMBINEVALUES builds key columns for relationships on two columns; Microsoft notes it assumes different inputs give different outputs, which lets DirectQuery optimise joins. In depth: CONCATENATEX.

What goes wrong?

  • Text cleanup in DAX columns. Splitting and trimming every row at refresh belongs in Power Query, where it folds to the source and keeps the model small.
  • FIND without a not-found value. One row without the text breaks the column.
  • VALUE on locale-formatted text. "1.234,5" may not convert; clean it in Power Query with the right locale.
  • Numbers converted to text. Text columns of numbers sort as text ("10" before "9").

Where can you check this?

Where do you start?

Move any text-cleaning calculated columns into Power Query, and keep DAX text work for labels and titles. Math and trig functions are the next reference.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.