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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
joooffice
Helper I
Helper I

Clear Field with non alpha numeric characters

Some of the data I am importing in my query is using a different alphabet so just appearing in the import as a random selection of special characters in the fields.

How do I clear the fields to null that contain these special characters without having to specify every different type of character?

 

1 ACCEPTED SOLUTION

The pedestrian way would be

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WOjz9UcOcw9MVgHTLosPTD004PP3oZBCvYQaQtUMBKg/kgplAJUf3AZWtgKmfqxSrE62Ul5+XqpCfplCSkViiFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([Column1], Character.FromNumber(215)) then true else false)
in
    #"Added Conditional Column"

 

The cool way is

 

https://community.powerbi.com/t5/Desktop/How-to-do-the-text-containsany-in-power-query/td-p/932611

View solution in original post

5 REPLIES 5
lbendlin
Super User
Super User

you have not specified the encoding used during ingestion.

 

You can look at the hex value of each character and decide if it is ANSI (0...127) or any of the Unicode starting bytes etc.  and then decide what to do in each case.

Thanks for the reply.

 

I dont know what encoding was used during ingestion. The fields are like this in my original excel document as it is exported from a database which can cope with the other alphabet.

 

An example field is:

 

דניאל בן דב ומרים

 

I just want the query to find all the cells that containt these types of characters ie not A...Z and usual punctuation and clear them to null

You can use 0xC3 - that's the × in your text. 

 

Or - you could use UTF-8 for ingestion.

How do I change the ingestion? The excel sheet that the query is picking up from has the characters in anyway.

 

Is there a way of saying if it is not A...Z or a...z then delete it?

The pedestrian way would be

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WOjz9UcOcw9MVgHTLosPTD004PP3oZBCvYQaQtUMBKg/kgplAJUf3AZWtgKmfqxSrE62Ul5+XqpCfplCSkViiFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([Column1], Character.FromNumber(215)) then true else false)
in
    #"Added Conditional Column"

 

The cool way is

 

https://community.powerbi.com/t5/Desktop/How-to-do-the-text-containsany-in-power-query/td-p/932611

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.