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
Irisohyama6
Frequent Visitor

How to check list of string contains list of specified special characters

I want to check whether my list (column 1-3) contains the specified special characters (List). I added custom column with the M code below, somehow it returns False but you can clearly see there is special characters in the strings. 

 

Thanks for help.

 

Table

Column1Column2Column3Custom

I have an applethe apple is greenI love appleFALSE
duwhbgi*ubnh()FALSE
uhr??ihHUij/jiUHub\FALSE
qw|wqeqe<>wd\FALSE
qwedEWDFqrARFtFALSE

 

ASCII_List

List

"
\
/
:
?
|
*

 

M Code

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("PY1BCsIwEEWvMmSlUrDgAYqgpd0KxUWSRWKGJqXEJjbNxsM7reJqHu99GM5ZC1YtCMqDmqYRWcFmi18G94I+InqSLYzP5eeZLDgzKVvyuncHOkl7u9tvIdlYVW5tTeeG4+CIuiZpIbYc8juH9U1Akcry9CDcALP5T9CQvd4vdYgE51s9Myk/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.ContainsAny({[Column1],[Column1],[Column1]},{ASCII_List[List]}))
in
    #"Added Custom"

 

 

2 ACCEPTED SOLUTIONS
wdx223_Daniel
Super User
Super User

is this what you want?

wdx223_Daniel_0-1656995727342.png

 

View solution in original post

Anonymous
Not applicable

Hi @Irisohyama6 ,

 

Please add a column by using:

[
    comb=[Column1]&[Column2]&[Column3],
    f=List.ContainsAny(Text.ToList(comb) ,ASCII_List) 
][f]

Eyelyn9_0-1657171330501.png

 

Best Regards,
Eyelyn Qin
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
Anonymous
Not applicable

Hi @Irisohyama6 ,

 

Please add a column by using:

[
    comb=[Column1]&[Column2]&[Column3],
    f=List.ContainsAny(Text.ToList(comb) ,ASCII_List) 
][f]

Eyelyn9_0-1657171330501.png

 

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

wdx223_Daniel
Super User
Super User

is this what you want?

wdx223_Daniel_0-1656995727342.png

 

Nathaniel_C
Community Champion
Community Champion

Hi @Irisohyama6 ,

Working on this, and thank you for the M code...I did notice Column1 is the only value.


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for that @Nathaniel_C . I changed it, but still the same result too.

 

 

Hi @Irisohyama6 ,

Sorry, am stumped.  Think it will be changing the column to a list.  However let us call on the m code gurus @ImkeF and @KenPuls 
Good Luck!

Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.