Forum Discussion
POWER QUERY - Check if a row contains substring from another table
Hi,
I wonder, if there is a way, how to look up for values between tables.
For example, there is a table containing (besides other columns) this column
| String (head) |
| Holiday in Mexico |
| Cuba cruise |
| Best ski resort Canada |
| Honeymoon Italy |
| cheap holiday |
Then, there is another table which contains a list of countries (see below).
Is there a way how to add a column in a table "String" whereas the value in this new column will contain the name of a country if the string contains a country. Otherwise, there will be "null" or just blank()
| Country (head) |
| Mexico |
| Cuba |
| Canada |
| Italy |
So the ourput for this case would be:
| String (head) | Country (head) |
| Holiday in Mexico | Holiday |
| Cuba cruise | Cuba |
| Best ski resort Canada | Canada |
| Honeymoon Italy | Italy |
| cheap holiday |
Then, is there a way, how to handle this? (see below)
Check, if there is a value from Countries[Substring] in String[String], if yes, add to String[String] the value from Countries[Country].
In the tables below, in the added column, there will be a value "Canada" and "Italy" becaluse "Canadian ski resorts" contains a substring "Canad"
| String (head) |
| Canadian ski resorts |
| Italian cuisine |
| Substring | Country |
| Canad | Canada |
| Ital | Italy |
Thank you in advance for suggestions..
Petr
1 Reply
- v-huizhn-msft
Microsoft Employee