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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Mimi_Ibrahim
Helper I
Helper I

How to identify Chinese Characters in Name Field

Hello, 

 

I need help to identify Chinese character in the 'Name' field. Can someone help? Example of the expected values are below. Thank you.

 

NameChinese Char?
Chong, Mei Li (驰 馳)Yes
Alex, Tan (施池)Yes
Chong, Pei YiNo
Linda, OoiNo
1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Mimi_Ibrahim , 

You could try below M code to see whether it work or not

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs7Iz0vXUfBNzVTwyVTQeLlyg8LLZZs1lWJ1opUcc1IrdBRCEvMUNJ5N2/ts4wKIMFRLAFBLZCZYxCczLyVRR8E/H8iNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type1" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each if Text.Remove([Column1],List.Transform({0..127}, each Character.FromNumber(_)))="" then "No" else "Yes")
in
    #"Added Custom"

 

You could refer to https://www.asciitable.com/  for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

5 REPLIES 5
dax
Community Support
Community Support

Hi @Mimi_Ibrahim , 

You could try below M code to see whether it work or not

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs7Iz0vXUfBNzVTwyVTQeLlyg8LLZZs1lWJ1opUcc1IrdBRCEvMUNJ5N2/ts4wKIMFRLAFBLZCZYxCczLyVRR8E/H8iNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type1" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each if Text.Remove([Column1],List.Transform({0..127}, each Character.FromNumber(_)))="" then "No" else "Yes")
in
    #"Added Custom"

 

You could refer to https://www.asciitable.com/  for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi Zoe Zhi, 

 

It works like a charm! Can you explain how the code works please? Many thanks for your help 🙂

I really want to know why you use Text.Remove. Before this I've been using Text.Contains which didnt work. 

 Text.Remove([Column1],List.Transform({0..127}, each Character.FromNumber(_)))=""

Hi @Mimi_Ibrahim , 

This might be related to variable's type, text.contains seem to be text, but text.remove seems to be any. You could refer to text-contains  for details.

By the way, List.Transform({0..127}, each Character.FromNumber(_))="" is used to list all chars , then you could use remove to remove characters from this list.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Many thanks Zoe Zhi, I really appreciate this! 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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