Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
Solved! Go to Solution.
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:-
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
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:-
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
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
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 57 | |
| 43 | |
| 41 | |
| 21 | |
| 17 |
| User | Count |
|---|---|
| 183 | |
| 114 | |
| 93 | |
| 62 | |
| 45 |