Slow calculation of calculated column in Power Pivot

Torn85

New Member
Joined
Nov 14, 2019
Messages
2
Hi, I'm having a performance issue while running the following formula:

"=Calculate(sum(lines[CB unit]),Filter(Lines,Lines[Index]<=earlier(Lines[index]))"

I'm only iterating over 150K rows, but the calculation times out and never seems to finish.

It works fine with 2K rows, but really starts to slow down around 20K rows.

The goal is to get a running total of product quantity by an index column.

Can anybody offer me some guidance on this?

Thanks
-T
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I should also note that I am running a power query with the following code before loading it to power pivot:

let
Source = Excel.Workbook(File.Contents("C:\Users\rjg01\Documents\DATAMODEL FILES\ORDER_LINES_TABLE-1.xlsx"), null, true),
#"Filtered Rows" = Table.SelectRows(Source, each ([Kind] = "Table")),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Name", "Data"}),
#"Expanded Data" = Table.ExpandTableColumn(#"Removed Other Columns", "Data", {"Order", "Line", "Customer Site Date", "Site Date Actual", "Due Date", "Earliest Delivery Date", "Ship Date Actual", "Last Ship Date", "Qty Ordered", "Invoiced", "Status", "Item", "Customer Item", "Unit Price", "Est Cost", "Approval Drawing Due", "Approval Drawing Actual", "Approval Drawing Returned", "Approval Drawing Returned2", "BOM Release Due", "BOM Release Actual", "Ship To", "Job", "Serial Number"}, {"Order", "Line", "Customer Site Date", "Site Date Actual", "Due Date", "Earliest Delivery Date", "Ship Date Actual", "Last Ship Date", "Qty Ordered", "Invoiced", "Status", "Item.1", "Customer Item", "Unit Price", "Est Cost", "Approval Drawing Due", "Approval Drawing Actual", "Approval Drawing Returned", "Approval Drawing Returned2", "BOM Release Due", "BOM Release Actual", "Ship To", "Job", "Serial Number"}),
#"Renamed Columns" = Table.RenameColumns(#"Expanded Data",{{"Item.1", "Item"}}),
#"Cobmined Forecast" = Table.Combine({#"Renamed Columns", FORECAST_LINES}),
#"Added Index1" = Table.AddIndexColumn(#"Cobmined Forecast", "Index", 1, 1),
#"Sorted Index Ascending" = Table.Sort(#"Added Index1",{{"Index", Order.Ascending}}),
#"Add CB Qty." = Table.AddColumn(#"Sorted Index Ascending", "CB Unit", each if Text.StartsWith([Item], "X") then [Qty Ordered] else if List.AllTrue({Text.StartsWith([Item], "ZGCB"),[#"Unit Price"] > 30000}) then if [Qty Ordered] > 1 then 1 else [Qty Ordered] else 0, type number),
#"Removed Columns" = Table.SelectColumns(#"Add CB Qty.",{"Order", "Line", "Index", "CB Unit"}),
#"Buffered Table" = Table.Buffer(#"Removed Columns")
in
#"Buffered Table"


I should further note that, without any modifications in Power Query, my data file, in Power Pivot, has no problems performing a similar expanding range summation. It only takes a few seconds to calculate over the 150K rows. Therefore, I must have some issue in Power Query.

I've looked into buffering my table, but that has not helped me. Perhaps, I'm not buffering at the right places?
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top