How can I search for multiple strings

0 votes

I want to check in a power query new column if a string like "This is a test string" contains any of the strings list items {"dog", "string", "bark"}.

I already tried Text.PositionOfAny("This is a test string",{"dog","string","bark"}), but the function only accepts single-character values

Expression.Error: The value isn't a single-character string.

Any solution for this?

Oct 24, 2018 in Power BI by Upasana
• 160 points
4,727 views

1 answer to this question.

0 votes

A simple solution is this:

List.ContainsAny(Text.SplitAny("This is a test string", " "), {"dog","string","bark"})

It transforms the text into a list because there we find a function that does what you need.

answered Oct 24, 2018 by Upasana
• 160 points
Hi,  instead of return true,   it is possible to return the string,  for e.g.  if string is "This is a dog"  then return as dog

Thank you !
Hey, @Christopher,

You want the selected value function. This does exactly what you want. It returns a value only if there is a single value, otherwise, it returns blank (or an optional alternate).

Related Questions In Power BI

0 votes
0 answers

How can I use R or Python scripts within Power BI for advanced data analysis?

How can I use R or Python ...READ MORE

Oct 14 in Power BI by anonymous
• 7,890 points
73 views
0 votes
0 answers

How can I use R or Python scripts within Power BI for advanced data analysis?

How can I use R or Python ...READ MORE

Oct 22 in Power BI by Evanjalin
• 7,890 points
106 views
+1 vote
1 answer

How can I use R or Python scripts within Power BI for advanced data analysis?

You can carry out advanced data analysis ...READ MORE

answered Oct 23 in Power BI by pooja
• 8,470 points
134 views
0 votes
0 answers

How can I retrieve distinct values from multiple columns using Power BI?

How can I retrieve distinct values from ...READ MORE

Oct 23 in Power BI by Evanjalin
• 7,890 points
70 views
0 votes
0 answers
0 votes
1 answer

How can I leverage the Power BI REST API for automated report deployment and management within my organization?

To ensure easier deployment and maintenance of ...READ MORE

answered Nov 14 in Power BI by pooja
• 8,470 points
53 views
0 votes
1 answer

How to export Power Queries from One Workbook to Another with VBA?

Try solving it using the Workbook. Query ...READ MORE

answered Oct 22, 2018 in Power BI by Annie97
• 2,160 points
6,787 views
0 votes
1 answer

Excel Power Query: Using List.MatchAny on a column value

try this. let TableA = ...READ MORE

answered Oct 22, 2018 in Power BI by Annie97
• 2,160 points
4,285 views
0 votes
1 answer

Power Query Web request results in “CR must be followed by LF” Error

What I think is, it might look ...READ MORE

answered Oct 29, 2018 in Power BI by Shubham
• 13,490 points
1,903 views
0 votes
1 answer

Select Columns from table instead of removing afterwards in Power Query

Try this. let db = Sql.Databases("sqlserver.database.url"){[Name="DatabaseName"]}[Data], Sales_vDimCustomer = ...READ MORE

answered Oct 31, 2018 in Power BI by Shubham
• 13,490 points
3,584 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP