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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors