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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Courtsheagraham
Regular Visitor

Using List.Contains causing long load time

Ok...let me see if I can explain this and get some help.

I've got static data in an external excel sheet.

I've loaded that into power query, then Transformed  a column to Convert to List and named it "InServiceXIDs_List"

I've then gone through multiple tables, and used "... each (List.Contains(InServiceXIDs_List,[unit_id])=true))" to filter "unit_id" according to the list.

 

I've also used two of my tables to create a Merge Queries as New. In the new merged queries I do not filter the data because it's already been filtered by the tables that merge being filtered...if that makes sense.

 

Everything is working, but when I Close & Apply it takes a very long time, 20 minutes or so, to load that data!

Can anyone explain as to why? Is the List.Contains going through each row and does that have to process from the excel sheet? I ask that because when I watch the Refresh window load it says the name of the excel sheet for each of the tables where I've used that List.Contains function.

So, does it go through each row, filtering the unit_id, then process that through and to the merged querie on each row!?! That would be extremely time intensive regarding the amount of data it would be parsing/filtering.

 

Thanks.

2 ACCEPTED SOLUTIONS
ppm1
Solution Sage
Solution Sage

In each table/query where you use the list, add a step up front that buffers your list with

 

BufferedList = List.Buffer(InServiceXIDs)

 

Then use BufferedList in place of InServiceXIDs in your later query step(s).  Also, you don't need to have "=true" after List.Contains.

 

Pat

Microsoft Employee

View solution in original post

Anonymous
Not applicable

Try this:

 

(List.Contains(List.Buffer(InServiceXIDs_List),[unit_id])=true))"

 

--Nate

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Try this:

 

(List.Contains(List.Buffer(InServiceXIDs_List),[unit_id])=true))"

 

--Nate

Thank you for the information! Seems to be working, about to run it through a similar report and see what the results there are. Thanks again.

ppm1
Solution Sage
Solution Sage

In each table/query where you use the list, add a step up front that buffers your list with

 

BufferedList = List.Buffer(InServiceXIDs)

 

Then use BufferedList in place of InServiceXIDs in your later query step(s).  Also, you don't need to have "=true" after List.Contains.

 

Pat

Microsoft Employee

worked like magic, thanks

Thank you for the info and feedback. I need to start doing exactly what you've done here with using the defined variables. I've not turned that to a habbit yet! And I was wondering about using "true", wasn't sure that I needed it, but the tutorial I referenced had it, so here I am! haa. Thanks again.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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