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.
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
ID | Name |
1 | coffeeprod |
2 | ABCcigarette |
3 | XXalcoholXX |
4 | ddbeverages |
Table2
SearchText |
coffee |
cigarette |
alcohol |
Thanks! it works for me.
Hello, Jack7
search = List.Buffer(Table2[SearchText]),
contains = Table.AddColumn(
Table1, "Contains",
(x) => List.MatchesAny(
search,
(w) => Text.Contains(
x[Name], w, Comparer.OrdinalIgnoreCase
)
)
)
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
User | Count |
---|---|
8 | |
5 | |
5 | |
5 | |
4 |
User | Count |
---|---|
12 | |
10 | |
8 | |
6 | |
6 |