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.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.