Forum Discussion

rlamping's avatar
rlamping
Frequent Visitor
4 years ago

Excel Power Query slow even with 2 simple table queries

One of my Excel worksheets took too much time to refresh the PowerQuery queries, so I tried to see if the same trouble existed with a small file.  The slowness of PowerQuery is even apparent in an Excel file that has to two tables with no data linked from the other website: A simple spreadsheet with 2 tables (3 to 4 columns each) with plain data for which I created 2 queries to capture that data (connection only). The Excel file is on sharepoint and we use Onedrive in the cloud.

 

Environment

I use Excel in Microsoft 365 Apps for Enterprise. Version 2108 (Build 14325.20910 Click to Run)

 

And yes all the advices found in message on the internet to speed up PowerQuery are set:

GLOBAL

DataLoad: 

Type Detection: Never detect column types …

Background data: Never allow data prviews to download in the backgroun

Default Query Load Settings: Specify custom default load settings.  Unchecked: Load to Worskheet, Load to Datamodel

Checked: Fast Data Load

 

Security: Web Preview Warning Level : Medium

 

Privacy Levels: Always ignore Privacy level Settings

Diagnostics: Enable tracing unchecked

 

CURRENT WORKBOOK

Dataload

Follows Global Settings

 

---

Expected behaviour:

Since the tables are in the worksheet, the data should be instantly available when switching between the queries.

Other users on Google mentioned, simple actions as renaming a query, that takes minutes.

 

Observed behaviour

With active Sync in OneDrive and WIFI is on, the switch between the table query in Power Query editor is not instant.

When I switch WIFI off, then the switch is instant. My WIFI is fast.

I tried separately using Table.Buffer; setting Web Preview Warning Level to None and pausing the OneDrive sync to no avail.

Also refreshing all queries within the Poewer Query Editor does not solve the issue. In Excel even Autorecover is switched off, as well as Autosave. Only switching WIFI off helps. And in this case, since the tables are in the worksheet, it is possible to do so, but not very nice if you want to show something in MS Teams for which the WIFI must be on.

Apparently some additional events are activated and jump in when Wifi is switched on.

 

I am very curious if someone knows a solution. Or is it that Microsoft has to solve this?

 

One of the queries:

 

let
Source = Excel.CurrentWorkbook(){[Name="AdditionalProjects"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ProjectNumber", type text}, {"ProjectName", type text}}),
#"Removed Duplicates" = Table.Distinct(#"Changed Type", {"ProjectNumber"})
in
#"Removed Duplicates"

 

No special things happen here!

2 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    assume Distinct is a very expensive function. try this code

    #"Removed Duplicates" = Table.FromRecords(List.Accumulate(Table.ToRecords(#"Changed Type"),{{},[]},(x,y)=>{if Record.HasField(x{1},y[ProjectNumber]) then x{0} else x{0}&{y},Record.TransformFields(x{1},{y[ProjectNumber],each _},2)}){0})

  • Run Fiddler or your browser network trace utility to see which calls are causing the slowdown.