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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
icturion
Resolver II
Resolver II

See if column string contains multiple text values

Hi,

 

Is there a way to search for two or more words within the same string of text?

 

I already tried with containsstring but then I can only give one word.

 

Example data:

Column
this text contains two words I want to search for to determine which group the content belongs to
this is another sentence where the content belongs to a different group

 

if the text contains the following words "text" and "search" then group 1,

if the text contains the following words "sentence" and "different" then group 2,

otherwise group 3

 

Searching for one word in the text is no problem, I have that working, I just can't figure it out if several words have to be looked at. hopefully someone knows a solution. thanks in advance

1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @icturion ,

 

Create a column with below code:-

Column 2 =
SWITCH (
    TRUE (),
    CONTAINSSTRING ( 'Table (4)'[Column], "text" )
        && CONTAINSSTRING ( 'Table (4)'[Column], "search" ), "Group 1",
    CONTAINSSTRING ( 'Table (4)'[Column], "sentence" )
        && CONTAINSSTRING ( 'Table (4)'[Column], "different" ), "Group 2",
    "Group 3"
)

Output:-

Samarth_18_0-1644224471624.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

3 REPLIES 3
Samarth_18
Community Champion
Community Champion

Hi @icturion ,

 

Create a column with below code:-

Column 2 =
SWITCH (
    TRUE (),
    CONTAINSSTRING ( 'Table (4)'[Column], "text" )
        && CONTAINSSTRING ( 'Table (4)'[Column], "search" ), "Group 1",
    CONTAINSSTRING ( 'Table (4)'[Column], "sentence" )
        && CONTAINSSTRING ( 'Table (4)'[Column], "different" ), "Group 2",
    "Group 3"
)

Output:-

Samarth_18_0-1644224471624.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Is there a way I could work this function to support a sequence of words? 

 

For example, 

 

I want two groups one if the text contains "collab" and "workstations" = group 1 and another if the text contains "collab" and "no workstations" = group 2

Thank you, I hadn't thought of the switch function. thanks for thinking along

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.