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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
Anonymous
Not applicable

List.Contains and List.Startswith

I have a question regarding a problem in power query M

Lets say I have table A with multiple projet 

a-bc

a-et,

h-gf,

c-df,

a-2d,

And I have a table B with project prefix 

a,

d,

c, 

I would like to filter the Table A with Table B. Since I have multiple table, I would only be required to change table B (add more prefix or remove)  instead of going in each table and put a filter with "startswith".

After filtering, the Table A would look like this

a-bc,

a-et,

c-df,

a-2d,

Thank you !

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Download sample PBIX file with solution code

 

Set up both tables and load into Power Query.

You can then filter the Projects table with the Prefix table with this line

 

= Table.SelectRows(Source, each List.ContainsAny(Text.ToList(Text.Start([Project],1)), Prefix[Prefix]))

 

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

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Download sample PBIX file with solution code

 

Set up both tables and load into Power Query.

You can then filter the Projects table with the Prefix table with this line

 

= Table.SelectRows(Source, each List.ContainsAny(Text.ToList(Text.Start([Project],1)), Prefix[Prefix]))

 

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!


Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.