DAX LEN function

Returns the number of characters in a text, including spaces.

LEN is a quick way to check text. It helps you spot values that are too long or too short, and it is often used together with LEFT, RIGHT and MID.

Syntax

LEN(<text>)
ArgumentRequiredDescription
textRequiredThe text to measure, or a column reference in a row context.

Returns: A whole number.

Examples

Calculated on the free practice data (table financials), with [Total Sales] = SUM(financials[Sales]) and [Total Profit] = SUM(financials[Profit]).

1. Length of each product name

Name Length = LEN(SELECTEDVALUE(financials[Product]))
ProductName Length
Amarilla8
Carretera9
Montana7
Paseo5
Velo4
VTT3

SELECTEDVALUE returns the product of each row of the table, and LEN counts its characters.

Try LEN yourself

Change the formula and run it on the 700-row practice data. Free, with no signup.

Want an exercise that checks your answer? Free DAX practice

Good to know

  • Spaces count as characters, so "Canada " has a length of 7. A length that looks wrong often means hidden spaces, which you can fix with Trim in Power Query.
  • A blank value has a length of 0.

Related functions

Official reference: LEN function on Microsoft Learn