r/excel 1d ago

unsolved Power Query Loading Time Tips

I have a Power query that is connected to a sharepoint folder. Whenever I try to refresh the file it would take around 10-40 mins of load time before it loads into the Data Model. Granted that the major reason for the loading time is due to the size of the data (estimating somewhere between 10-12M rows after filtering), but what are some ways that I can speed up the loading.

19 Upvotes

20 comments sorted by

u/AutoModerator 1d ago

/u/pyu2c - Your post was submitted successfully.

Failing to follow these steps may result in your post being removed without warning.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

37

u/Alex_Gob 1d ago

Use the function SharePoint.Content instead of SharePoint.Files : SharePoint.files will list ALL the files in the SharePoint library, while SharePoint.Content allows you to select one or many folders. It adds more steps but on a crowded SharePoint, it's much faster.

7

u/whodidthistomycat 2 23h ago

Yep this is the correct solution

3

u/pyu2c 23h ago

Ohhh thanks for this. So if I use Sharepoint.Content i still have to navigate to the specific folder, correct?

2

u/Alex_Gob 20h ago

Yes : you navigate into a folder by "unfolding" it (pun not intended). It's rather intuitive : you select one (or many) folders that you can then unfold (open) and continue to navigate into the subfolders. You might need a bit of troubleshooting if your files are at different "depth" but it shouldn't be a big deal.

19

u/lighthearted_emperor 1d ago

Fold the queries before they ever hit the data model, but with 12M rows you're still gonna be waiting long enough to make a sandwich.

6

u/eggface13 1 1d ago edited 1d ago

How complex are the transformations? Certain transformations can obviously be pretty painful on millions of rows (sorts, merges the obvious ones, and definitely never get different rows talking to each other!). 12 million rows is a lot but if you there's any transformations you can resolve within the data model through DAX formulas or dimension tables, that's going to be a tonne more efficient.

1

u/pyu2c 23h ago

I merged 2 separate tables, removed duplicates and columns. Thinking of removong other columns as well.

I also did some data type conversions

4

u/bobo5195 1d ago

It should not take that long. Merge the query's into 1 - flatten.

Try a query just loading the data for how long it takes.

1

u/pyu2c 23h ago

I'll try to do this. I'm fairly new to Power Query so I'll have to navigate by tomorrow.

2

u/cbolender2004 1d ago

Use a variety of methods including python and or powershell scripts and power automate, and extract the data in a the target folder files and write it to a csv file or set of csv files (one per distinct data type). Then you query the csv file(s). Much much much faster.

1

u/pyu2c 23h ago

Do I need to combine the csv files into one to simplify the loading?

1

u/cbolender2004 4h ago

Yes, in your extract script you consolidate the data from all the files into the one flat csv. Do this per table found in each file. So if all the files a have a revenue table and a purchase table, you do the extract to create one revenue csv and one expense csv

2

u/Mdayofearth 127 1d ago

How fast is your internet?

How much RAM does your system have?

What processor do you have? Total cores, fastest all core speeds, cache sizes, etc.

2

u/Pistolius 1 23h ago

Make sure you're buffering the tables

Table.Buffer()

2

u/ArrowheadDZ 2 7h ago

I use buffering a lot, but I am not sure this will work in this use case. If I am going to do a merge/join to “lookup” data for 5,000 records in a 200 record “lookup” table, buffering the lookup table can really help. But if you have a 12 million record table you are loading, I don’t think buffering the table will necessarily get better performance, and shouldn’t improve the initial load time. You still have to get that monster into PQ from Sharepoint first, whether you are going to buffer it or not.

1

u/Key_Guarantee5416 1d ago

I think its connected to how fast your computer is selected to run in settings.

I had the same problem. My colleague changed some settings in laptop and now my queries dont take more than 20 minutes(if they are big)

Smalls ones get refreshed really quick

1

u/InfoMsAccessNL 1 23h ago

I turned a 20 min PQ into seconds by using a simple combine function (for csv files with the same columns, lighting fast like a second). Then i can work with one big csv file.The transformations are done with vba using arrays and dao.recordsets. I must say that i copy the csv files first to my harddiskt to make it faster.

1

u/pyu2c 23h ago

I opted to do it in Sharepoint since my goal is for the main Excel file to be updated regularly by a team.