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
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Torn85

New Member
Joined
Nov 14, 2019
Messages
2
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?
 

Watch MrExcel Video

Forum statistics

Threads
1,101,785
Messages
5,482,921
Members
407,367
Latest member
FunkyFriedChicken

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top