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
Syndicate_Admin
Administrator
Administrator

How to check if a column contains the characters in the column of another table

Hi, 

 

I have 2 tables below. I need to have a new column in Table1 to have a Boolean value if the Text contains any value listed in Table2 column "SearchText". I have tried to use list.ContainsAny() , but there is no space in the text so I can't use split to generate a text list. Is there any idea to achieve it? Thank!

Table1 

IDName
1coffeeprod
2ABCcigarette
3XXalcoholXX
4ddbeverages

 

Table2

SearchText
coffee
cigarette
alcohol
3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

Thanks! it works for me. 

AlienSx
Super User
Super User

Hello, Jack7

    search = List.Buffer(Table2[SearchText]),
    contains = Table.AddColumn(
        Table1, "Contains", 
        (x) => List.MatchesAny(
            search, 
            (w) => Text.Contains(
                x[Name], w, Comparer.OrdinalIgnoreCase
            )
        )
    )
Syndicate_Admin
Administrator
Administrator

Hi @Jack7 ,

 

I assume that if value in Name column returns "true", otherwise, returns "false".

Please try this:

AddColumns(Table1,"test",!IsBlank(LookUp(ForAll(Table2.SearchText As C,C.SearchText in Name),Value=true)))

 

Best regards,

Rimmon

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.