Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Eastwood
Frequent Visitor

DAX will get false Unicode from character

Hello Community,

 

this is my first time asking a question here! 🙂 

 

I want to find every lower and upper character in a string. To achieve this, I use the following DAX statement:

DEFINE
VAR Repl_Char = FORMAT ("Adma Sandler","STRING")
VAR Mylen = LEN ( Repl_Char )
VAR mytable =
ADDCOLUMNS (
GENERATESERIES ( 1, mylen ), "Original", MID ( Repl_Char, [Value], 1 ))
VAR Result_Uni =
ADDCOLUMNS (
SELECTCOLUMNS (
ADDCOLUMNS ( mytable, "uni_char", UNICODE ( [Original] ) ),
"Number", [Value],
"Original",[Original],
"Unicode", [uni_char]
),
"uppercase_lowercase",
IF (
[Unicode] >= 97
&& [Unicode] <= 122,
"lower",
IF ( [Unicode] >= 65 && [Unicode] <= 90, "upper","non alpha" )
)
)

EVALUATE
Result_Uni

 

If I execute this I will receive the follow:

NumberOriginalUnicodeuppercase_lowercase
1A65upper
2d100lower
3m109lower
4A65upper
5 32non alpha
6S83upper
7A65upper
8n110lower
9d100lower
10l108lower
11e101lower
12r114lower

 

Question:

1. Could someone help to understand why this situation is happend? 

2. It would be really helpful if someone has an idea to solve this. 

 

BTW: I only have the option to use DAX for this challenge. 😉

 

Many thanks

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

I'm pretty sure this has to do with case-insensitive column compression as I explain here:

https://community.powerbi.com/t5/Desktop/Single-character-in-Text-field-changing-from-upper-to-lower...

 

While I don't think there's a way to make the [Original] column as you expect, you should be able to fix the other columns by immediately converting to Unicode like this:

DEFINE
VAR Repl_Char = FORMAT ( "Adma Sandler", "STRING" )
VAR Mylen = LEN ( Repl_Char )
VAR mytable =
    ADDCOLUMNS (
        GENERATESERIES ( 1, mylen ),
        "Unicode", UNICODE ( MID ( Repl_Char, [Value], 1 ) )
    )
VAR Result_Uni =
    SELECTCOLUMNS (
        mytable,
        "Number", [Value],
        "Original", UNICHAR ( [Unicode] ),
        "Unicode", [Unicode],
        "uppercase_lowercase",
            IF (
                [Unicode] >= 97 && [Unicode] <= 122,
                "lower",
                IF ( [Unicode] >= 65 && [Unicode] <= 90, "upper", "non alpha" )
            )
    )
EVALUATE
    Result_Uni

View solution in original post

4 REPLIES 4
AlexisOlson
Super User
Super User

I'm pretty sure this has to do with case-insensitive column compression as I explain here:

https://community.powerbi.com/t5/Desktop/Single-character-in-Text-field-changing-from-upper-to-lower...

 

While I don't think there's a way to make the [Original] column as you expect, you should be able to fix the other columns by immediately converting to Unicode like this:

DEFINE
VAR Repl_Char = FORMAT ( "Adma Sandler", "STRING" )
VAR Mylen = LEN ( Repl_Char )
VAR mytable =
    ADDCOLUMNS (
        GENERATESERIES ( 1, mylen ),
        "Unicode", UNICODE ( MID ( Repl_Char, [Value], 1 ) )
    )
VAR Result_Uni =
    SELECTCOLUMNS (
        mytable,
        "Number", [Value],
        "Original", UNICHAR ( [Unicode] ),
        "Unicode", [Unicode],
        "uppercase_lowercase",
            IF (
                [Unicode] >= 97 && [Unicode] <= 122,
                "lower",
                IF ( [Unicode] >= 65 && [Unicode] <= 90, "upper", "non alpha" )
            )
    )
EVALUATE
    Result_Uni

Hello @AlexisOlson, many thanks for your explanation! 🙂 I now understand why my approach to identify the characters did not work! 😉 Your solution will save my day! 

amitchandak
Super User
Super User

@Eastwood , Why is there a problem with the other A = 65?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak many thx for your reply. The search string "Adma" has the last lower character "a". But the Unicode are referenced to an upper character.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.