Forum Discussion
Very Slow Performance on Group By
- 4 years ago
Hi TheCreepster1 ,
Don't append and merge at all.
Set your model up in the STAR SCHEMA structure, where your Sales and Inventory tables are the FACT tables, and any common fields (e.g. Location, Product etc.) are aggregated into DIMENSION tables that are then related to both fact tables.
You can then write measures that span both fact tables, as well as display data from both in visuals using the dimension table fields to maintain commonality between them.
https://docs.microsoft.com/en-us/power-bi/guidance/star-schema
Another option would be to have your SQL query written on the source as a view, rather than being a native query from Power Query. Presuming both of your tables are on the same DB/server, your append/group steps should be able to be folded back to the source, which would be significantly quicker at performing these functions than Power Query.
Pete
Try buffering the table to improve the performance.
Replace
#"Appended Query" = Table.Combine({#"Sales Query", #"Stock Query"}),with
#"Appended Query" = Table.Buffer(Table.Combine({#"Sales Query", #"Stock Query"})),