Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
imnotabot01001
Regular Visitor

Filter rows by CONTAIN criteria from a list (AND)

Hi- my table needs to be filtered by a list. Text contained in list should be used as an AND criteria (only show rows that contain all texts from list). Help please 😞

 

my table:

DateProduct_Name
1/1AA BB CC

1/2

BB CC XYZ
1/3AABB XYZ

1/4

BBCC

 

listA (criteria):

AA
XYZ

 

desired result:

DateProduct Name
1/3AABB XYZ

 

*I've done a NOT criteria filter based on the below. this acts like an OR , whereas I need an AND 

Table.SelectRows(#"Added Custom", each List.Count(Splitter.SplitTextByAnyDelimiter(listA)([Product_Name])) > 1)

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @imnotabot01001 

Download sample Excel file with query

Here's the code:

 

let
    Source = Excel.CurrentWorkbook(){[Name="TextTable"]}[Content],
    Result = Table.AddColumn(Source, "Check", 
    
        (FindStrings) => 
        
        List.AllTrue(List.Transform(WordList, each Text.Contains((FindStrings[Product_Name]), _ )))),
    #"Filtered Rows" = Table.SelectRows(Result, each ([Check] = true)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Check"})

in
    #"Removed Columns"

 

 

xxy.png

 

If you want to do further reading/see more examples of this kind of thing check here

Searching for Text Strings in Power Query • My Online Training Hub

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

4 REPLIES 4
PhilipTreacy
Super User
Super User

Hi @imnotabot01001 

Download sample Excel file with query

Here's the code:

 

let
    Source = Excel.CurrentWorkbook(){[Name="TextTable"]}[Content],
    Result = Table.AddColumn(Source, "Check", 
    
        (FindStrings) => 
        
        List.AllTrue(List.Transform(WordList, each Text.Contains((FindStrings[Product_Name]), _ )))),
    #"Filtered Rows" = Table.SelectRows(Result, each ([Check] = true)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Check"})

in
    #"Removed Columns"

 

 

xxy.png

 

If you want to do further reading/see more examples of this kind of thing check here

Searching for Text Strings in Power Query • My Online Training Hub

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi @PhilipTreacy thanks for this it works!! exactly what I was looking for. 

Not essential but, would there be a way to shorten code so there's only one step involved? Thanks again!

Hi @imnotabot01001 

No not really.  I mean you could move the code into a function and call that in one step but that's overcomplicating things.

You can rearrange the code like so if you want

let
    Source = Excel.CurrentWorkbook(){[Name="TextTable"]}[Content],
    Result = Table.AddColumn(Source, "Check", (FindStrings) => List.AllTrue(List.Transform(WordList, each Text.Contains((FindStrings[Product_Name]), _ )))),
    #"Filtered Rows" = Table.SelectRows(Result, each ([Check] = true)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Check"})
in
    #"Removed Columns"

regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

You could do this:

 

Table.SelectRows(#"Added Custom", each Text.Contains(Text.Combine(listA), [Product_Name]))

 

--Nate

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors