Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
How can I make this query more efficient to cut down on load times? I have roughly 174 files (+1 daily) merged to provide 220k rows. The load times are becoming problematic. Please see the code below and help if possible:
let
Source = SharePoint.Files("https://********.com/sites/******"),
#"Filter Folder" = Table.SelectRows(Source, each ([Folder Path] = "https://***********.com/sites/****/***")),
#"Filtered Rows" = Table.SelectRows(#"Filter Folder", each ([Extension] = ".csv")),
#"Added Custom" = Table.AddColumn(#"Filtered Rows", "Custom", each Csv.Document([Content])),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
#"Expanded Custom" = Table.ExpandTableColumn(#"Removed Other Columns", "Custom", {"Column1", "Column11", "Column2", "Column3", "Column4", "Column6"}, {"Custom.Column1", "Custom.Column11", "Custom.Column2", "Custom.Column3", "Custom.Column4", "Custom.Column6"}),
#"Promoted Headers" = Table.PromoteHeaders(#"Expanded Custom", [PromoteAllScalars=true]),
#"Filtered Rows2" = Table.SelectRows(#"Promoted Headers", each ([Date] <> "Date")),
#"Filter Null Dates" = Table.SelectRows(#"Filtered Rows2", each [Date] <> null and [Date] <> ""),
#"Change Date Type" = Table.TransformColumnTypes(#"Filter Null Dates",{{"Date", type date}}),
in
#"Change Date Type"
Solved! Go to Solution.
That's a pretty straight forward query, so not much optimization potential. One thing you could do is do your promote headers in the custom column step with the change below, which would eliminate that step and the Filter step to remove the rows with "Date". You'll have to redo your Expand column steps with the new column names.
Replace each Csv.Document([Content]) with each Table.PromoteHeaders(Csv.Document[Content]))
That probably won't speed things up much. Another thing to consider is to use that M code to create a Dataflow and then use that dataflow in your report instead. That would move the refresh offline and your desktop file would refresh faster against the Dataflow.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
That's a pretty straight forward query, so not much optimization potential. One thing you could do is do your promote headers in the custom column step with the change below, which would eliminate that step and the Filter step to remove the rows with "Date". You'll have to redo your Expand column steps with the new column names.
Replace each Csv.Document([Content]) with each Table.PromoteHeaders(Csv.Document[Content]))
That probably won't speed things up much. Another thing to consider is to use that M code to create a Dataflow and then use that dataflow in your report instead. That would move the refresh offline and your desktop file would refresh faster against the Dataflow.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.