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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Moomins
Regular Visitor

Filter data based on list from another worksheet

Hi 

 

I have a worksheet "A" which contains extracted data using Power Query. The data has 5000 lines which I want to filter down to just 60 lines using data extracted from another worksheet "B".

 

A columns are CODE, Name, then more columns

B has only 1 column CODE listing the 60 values. Below is the code to extract the list ...

= Table.SelectRows(#"Removed Other Columns", each ([CODE] <> "" and [CODE] <> "Total"))

 

Your guidance much appreciated

1 ACCEPTED SOLUTION
serpiva64
Solution Sage
Solution Sage

Hi,

you can try this 2 options

- with merge (RightOuter)

serpiva64_0-1712331949230.png

- with List.Contains 

adding a custom column

= Table.SelectRows( Table.AddColumn(Source, "Custom", each List.Contains(B[Code], _[Code])), each [Custom]=true)

serpiva64_1-1712332088445.png

You can see it in the attached file

If this post isuseful to help you to solve your issue consider giving the post a thumbs up and accepting it as a solution !

 

View solution in original post

3 REPLIES 3
serpiva64
Solution Sage
Solution Sage

Hi,

you can try this 2 options

- with merge (RightOuter)

serpiva64_0-1712331949230.png

- with List.Contains 

adding a custom column

= Table.SelectRows( Table.AddColumn(Source, "Custom", each List.Contains(B[Code], _[Code])), each [Custom]=true)

serpiva64_1-1712332088445.png

You can see it in the attached file

If this post isuseful to help you to solve your issue consider giving the post a thumbs up and accepting it as a solution !

 

Thank you so much @serpiva64 

adudani
Super User
Super User

hi @Moomins ,

 

try using List.ContainsAny   after "Each"

Alternatively, would performing and inner join to filter out the relevant data be an option for your (less performant)

 

if none of this work, kindly provide a sample input and output dataset masking sensitive information

 

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors