Forum Discussion
Text search
- 4 years ago
Hello there Ara_Karapetyan ! I think it would be best for you to perform these actions in Power Query rather than a measure. Open the Query Editor and add a custom column. In the pop up window paste the following code.
Try this for the category column:
=let myvalue=[Search string] in Text.Combine( Table.SelectRows(SecondTable, each Text.Contains(myvalue,[Name]))[Category] , ",")And this for the group:
=let myvalue=[Search string] in Text.Combine( Table.SelectRows(SecondTable, each Text.Contains(myvalue,[Name]))[Group] , ",")Hope this answer solves your problem! If you need any additional help please tag me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!
Best regards,
Gonçalo Geraldes
I use 2 tables:
The main one contains thousands of transactions like:
| Date | Name |
| 21/08/21 | LENTA-809 |
| 23/08/21 | LENTA-809 |
| 24/08/21 | BELAYA APTEKA ORDZH |
| 25/08/21 | MEDKLUB |
| 26/08/21 | STOLINYJ DOKTOR |
The second one (the helper table) contains the list of search strings, categories, and groups:
| Search string | Category | Group |
| apte | Drugstore | Health |
| lenta | Suipermarket | Food |
| doc | Drugstore | Health |
My need is to filter the upper table "Name" column with the "Search strig" from the second one and use "Category" and "Group" columns.
I cant use relations between the tables because I need sort of "CONTAINSSTRING" solution.
Thanks in advance.
Hello there Ara_Karapetyan ! I think it would be best for you to perform these actions in Power Query rather than a measure. Open the Query Editor and add a custom column. In the pop up window paste the following code.
Try this for the category column:
=let myvalue=[Search string]
in
Text.Combine(
Table.SelectRows(SecondTable,
each Text.Contains(myvalue,[Name]))[Category]
,
",")
And this for the group:
=let myvalue=[Search string]
in
Text.Combine(
Table.SelectRows(SecondTable,
each Text.Contains(myvalue,[Name]))[Group]
,
",")
Hope this answer solves your problem! If you need any additional help please tag me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!
Best regards,
Gonçalo Geraldes
- SilviaM4 years agoFrequent Visitor
It works for me!! thanks a lot to share it!!
- Ara_Karapetyan4 years agoHelper I
So there is no way to do it via measure?