| description | Learn more about: LEN |
|---|---|
| title | LEN function (DAX) |
[!INCLUDEapplies-to-measures-columns-tables-visual-calculations]
Returns the number of characters in a text string.
LEN(<text>)
| Term | Definition |
|---|---|
text |
The text whose length you want to find, or a column that contains text. Spaces count as characters. |
A whole number indicating the number of characters in the text string.
-
Whereas Microsoft Excel has different functions for working with single-byte and double-byte character languages, DAX uses Unicode and stores all characters with the same length.
-
LEN always counts each character as 1, no matter what the default language setting is.
-
If you use LEN with a column that contains non-text values, such as dates or Booleans, the function implicitly casts the value to text, using the current column format.
-
Starting with desktop january release, user can set new model property UnicodeCharacterBehavior. Depending on value of the property, the output of LEN() function changes.
-
With CodeUnits default value of UnicodeCharacterBehavior property, the len('😀) will return => 2. This is old behavior of LEN function.
-
With CodePoints value of UnicodeCharacterBehavior property, the len('😀) will return => 1. This will be new behavior of LEN function.
The following formula sums the lengths of addresses in the columns, [AddressLine1] and [AddressLine2].
= LEN([AddressLine1])+LEN([AddressLin2])