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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
IamTDR
Responsive Resident
Responsive Resident

Best Practice for Filtering a Table by Another Table in Power Query

Hi
Just wondering from a performance issue, which method is better and why? Using a 'inner' merger between two tables or filtering a table using a list.

I usually get requests to do a report based on a certain group of customers, and yet the customer table is very large. So, I usually filter the sales table down to just the chosen customers. Both methods mentioned above work, but which is the best practice method? Another option is to load the full table and use DAX to filter for the group of customers. That method does not seem correct to me as that would have power query loading unnecessary records.
I believe the method of using list to filter a table, keeps the query native, so that’s a positive.
Thoughts

 

1 ACCEPTED SOLUTION

Hi  @IamTDR ,

 

You could also use query parameters to filter data before loading :

https://docs.microsoft.com/en-us/power-query/power-query-query-parameters

 


Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

View solution in original post

6 REPLIES 6
watkinnc
Super User
Super User

It depends. The distinct buffered list is wonderful:

= Table.SelectRows(table, each List.Contains(List.Buffer(List.Distinct(NameOfFilterListOrColumn)), [NameOfThisTableColumn]))

That's a very fast filter. But a well indexed db can be pretty fast using an inner join.

As the poet said, "It depends."

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
IamTDR
Responsive Resident
Responsive Resident

Thanks I'll try to add the List.Buffer to the code.

Hi  @IamTDR ,

 

You could also use query parameters to filter data before loading :

https://docs.microsoft.com/en-us/power-query/power-query-query-parameters

 


Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

Thanks
This does seem like another option to filter a table by another query within power query.
I guess all three options performance is the same?

Hi @IamTDR ,

 

Is your issue solved now?Could you pls mark the reply as answered to close it?

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Hi  @IamTDR ,

 

Not exactly,parameters can be used in more senarios,as mentioned in the document,query parameter can be used for functions,when you need a complex filtering with your data ,it would be a best choice.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors