Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |