Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I would like to have a Text.Contains that searches Column A for "Example" OR "Examples" OR "Examples2". I am sure it is staring me in the face but I cannot figure out how to do it.
Solved! Go to Solution.
Hi @Anonymous ,
Please try this:
if Text.Contains([Column1],"Example") = true then [Column1] else null
The function of Text.Contains will search out all the data which contains the key word. So you just need to write Text.Contains one time.
If you want to filter data, you could try this:
= Table.SelectRows(#"Changed Type", each Text.Contains([Column1], "Example"))
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Put these Example(s) words you want to find in strings in lists and then use the List.MatchesAny function.
Like in the following example:
Define a table with your keywords... (Example,Examples,sample...)
Transform_Keywords_list_in_list =
Table.TransformColumns
(
Source
,{
"Keywords list"
,each Text.Split(_, ",")
}
),
Main_Data =
Table.AddColumn
(
Main_Data_Table
,"Returned_Text"
,(MAIN)=>
let
Buffered_Keywords_list_in_list = Table.Buffer(Keywords_list_in_list ),
FilteredTable = Table.SelectRows
(
Buffered_Keywords_list_in_list
,(KEYWORDS)=>
List.MatchesAny(KEYWORDS[Keywords list], each Text.Contains(MAIN[String_to_test], _, Comparer.OrdinalIgnoreCase))
),
selectValue = Table.First(FilteredTable)[Value_to_return] // or you can return directly the table... selectValue = FilteredTable
in
selectValue, type text // or if you need the table returned selectValue, type table
),
If you are trying to perform this on a table, you would like to use something like:
#"Filtered Rows" = Table.SelectRows(table, each( Text.Contains([ColumnA], "Executive") or Text.Contains([ColumnA], "General") ))
Regards
@JasonTX, thanks for the suggestion. I have been doing it that way, but I am hoping I can cut out the repetitious "Text.Contains".
Hi @Anonymous ,
Please try this:
if Text.Contains([Column1],"Example") = true then [Column1] else null
The function of Text.Contains will search out all the data which contains the key word. So you just need to write Text.Contains one time.
If you want to filter data, you could try this:
= Table.SelectRows(#"Changed Type", each Text.Contains([Column1], "Example"))
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Put these Example(s) words you want to find in strings in lists and then use the List.MatchesAny function.
Like in the following example:
Define a table with your keywords... (Example,Examples,sample...)
Transform_Keywords_list_in_list =
Table.TransformColumns
(
Source
,{
"Keywords list"
,each Text.Split(_, ",")
}
),
Main_Data =
Table.AddColumn
(
Main_Data_Table
,"Returned_Text"
,(MAIN)=>
let
Buffered_Keywords_list_in_list = Table.Buffer(Keywords_list_in_list ),
FilteredTable = Table.SelectRows
(
Buffered_Keywords_list_in_list
,(KEYWORDS)=>
List.MatchesAny(KEYWORDS[Keywords list], each Text.Contains(MAIN[String_to_test], _, Comparer.OrdinalIgnoreCase))
),
selectValue = Table.First(FilteredTable)[Value_to_return] // or you can return directly the table... selectValue = FilteredTable
in
selectValue, type text // or if you need the table returned selectValue, type table
),
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
69 | |
68 | |
40 | |
29 | |
26 |
User | Count |
---|---|
89 | |
49 | |
44 | |
38 | |
37 |