Skip to content

Conversation

@rashidsarwar
Copy link

Clarified behavior of LEN function with UnicodeCharacterBehavior property on model

Clarified behavior of LEN function with UnicodeCharacterBehavior property on model
@prmerger-automator
Copy link
Contributor

@rashidsarwar : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change.

@learn-build-service-prod
Copy link
Contributor

Learn Build status updates of commit 0cfeeea:

✅ Validation status: passed

File Status Preview URL Details
query-languages/dax/len-function-dax.md ✅Succeeded

For more details, please refer to the build report.

Copy link
Contributor

@jeroenterheerdt jeroenterheerdt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after we agree with this update we should make sure to update all the other pages


- 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(<text>) function changes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend we don't make it so dependent on the january release in the docs. I'd just say: In recent versions, you can set the UnicodeCharacterBehavior property.


- Starting with desktop january release, user can set new model property UnicodeCharacterBehavior. Depending on value of the property, the output of LEN(<text>) 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't there a ' missing? len('🍕')? same a couple of lines earlier.

@v-dirichards
Copy link
Contributor

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

@prmerger-automator prmerger-automator bot added the aq-pr-triaged tracking label for the PR review team label Dec 17, 2025
@v-dirichards v-dirichards requested a review from Copilot December 17, 2025 21:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the documentation for the DAX LEN function to clarify its behavior with the new UnicodeCharacterBehavior model property. The update explains how the function handles Unicode characters differently based on whether the property is set to CodeUnits (default, legacy behavior) or CodePoints (new behavior), using emoji as an example.

  • Adds documentation explaining the UnicodeCharacterBehavior property's impact on LEN function behavior
  • Provides examples showing how emoji characters are counted differently with CodeUnits vs CodePoints settings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +36 to +37
- 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.
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string literal '😀 is missing a closing single quote. It should be '😀' to properly close the string.

Suggested change
- 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.
- 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.

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +37
- 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.
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name should be consistently uppercase. Change "len('😀)" to "LEN('😀')" to match the standard DAX function naming convention used throughout the documentation (e.g., line 14, 31, 33, 41).

Suggested change
- 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.
- 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.

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +37
- 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.
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name should be consistently uppercase. Change "len('😀)" to "LEN('😀')" to match the standard DAX function naming convention used throughout the documentation (e.g., line 14, 31, 33, 41).

Suggested change
- 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.
- 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.

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +37
- 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.
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider replacing the informal "=>" notation with clearer language such as "will return 2" or "returns 2" to be consistent with more formal technical documentation style.

Suggested change
- 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.
- With CodeUnits default value of UnicodeCharacterBehavior property, the len('😀) returns 2. This is old behavior of LEN function.
- With CodePoints value of UnicodeCharacterBehavior property, the len('😀) returns 1. This will be new behavior of LEN function.

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +37
- Starting with desktop january release, user can set new model property UnicodeCharacterBehavior. Depending on value of the property, the output of LEN(<text>) 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.
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new documentation about UnicodeCharacterBehavior contradicts the existing remark on line 31 which states "LEN always counts each character as 1, no matter what the default language setting is." Since the behavior now changes based on the UnicodeCharacterBehavior property setting, line 31 should be updated to clarify that this statement applies only to the default CodeUnits behavior, or be revised to reflect the conditional behavior.

Copilot uses AI. Check for mistakes.

- 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(<text>) function changes.
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The month name "january" should be capitalized to "January" for proper noun capitalization. Additionally, "user" should be "users" or "the user" for better grammar.

Suggested change
- Starting with desktop january release, user can set new model property UnicodeCharacterBehavior. Depending on value of the property, the output of LEN(<text>) function changes.
- Starting with the January desktop release, users can set the new model property UnicodeCharacterBehavior. Depending on value of the property, the output of LEN(<text>) function changes.

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +37
- 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.
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string literal '😀 is missing a closing single quote. It should be '😀' to properly close the string.

Suggested change
- 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.
- 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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants