LEN
How many characters a text has.
Group: Text. Compatible with DAX.
Syntax
LEN ( <text> )
| Parameter | Type | Description |
|---|---|---|
text | Text | The text to measure; a number becomes text first. |
Returns
Whole number. How many characters long the text is.
Remarks
- A blank gives BLANK, while empty text gives 0.
- Spaces count, at the ends too.
TRIMremoves the extra ones. - Characters are counted as DAX counts them: an emoji such as 😀 counts as 2.
Examples
Lengths
EVALUATE
ROW (
"Lettøl", LEN ( "Lettøl" ),
"Empty", LEN ( "" ),
"Blank", LEN ( BLANK () ),
"2026", LEN ( 2026 ),
"With spaces", LEN ( " a " )
)
| Lettøl | Empty | Blank | 2026 | With spaces |
|---|---|---|---|---|
| 6 | 0 | (blank) | 4 | 3 |
An emoji counts twice
EVALUATE
ROW ( "Emoji", LEN ( "😀" ), "Letter", LEN ( "a" ) )
| Emoji | Letter |
|---|---|
| 2 | 1 |
The products' names
EVALUATE
SELECTCOLUMNS (
Products,
"Product", Products[Product],
"Characters", LEN ( Products[Product] )
)
ORDER BY [Product]
| Product | Characters |
|---|---|
| Cider | 5 |
| IPA | 3 |
| Lettøl | 6 |
| Pils | 4 |
Related functions
LEFT, RIGHT, MID, TRIM, PATHLENGTH.