Forum

Index 'offset' real...
 
Notifications
Clear all

Index 'offset' really slowing refresh times

3 Posts
2 Users
0 Reactions
273 Views
(@greenboy)
Posts: 25
Topic starter
 

Hi

I need to create a column which takes the value from another column two rows above, based on a value in a 3rd columns

My code snippet looks like this.

#"Added Index" = Table.AddIndexColumn(#"Removed Columns", "Index", 1, 1),
#"Added Custom" = Table.AddColumn(#"Added Index", "Original PO Value", each if [Attribute] = "Passive Build" then null else if [Attribute] = "Active Build" then null else if

[Attribute] = "Passive Final Account" then #"Added Index"{[Index]-3}[PO Money] else if

[Attribute] = "Active Final Accout" then #"Added Index"{[Index]-3}[PO Money] else null),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "PO App ", each [Agreed Value] -[Original PO Value])
in
#"Added Custom1"

 

I have added an Index olumn starting at 1, which seems to mean that the offset is -3 even though the values are coming from only 2 rows above..

 

Any way - for approx 1600 rows of data this is slowing what was a fast query down to 3 mins.

 

Any clues as to why, and any pointers on how to get round this would be gratefully received.

GreenBoy

PS - i have already turned off the Date > Connection> Enable background refresh for this query and any that it refers to.

 
Posted : 28/04/2019 1:05 pm
(@catalinb)
Posts: 1937
Member Admin
 

Hi Dave,

Use Table.Buffer to speedup:

#"Added Index" = Table.Buffer(Table.AddIndexColumn(#"Removed Columns", "Index", 1, 1)),

You can also optimize the evaluation step:

#"Added Custom" = Table.AddColumn(#"Added Index", "Original PO Value", each if [Attribute] = "Passive Build" or [Attribute] = "Active Build" then null else if [Attribute] = "Passive Final Account" or [Attribute] = "Active Final Accout" then #"Added Index"{[Index]-3}[PO Money] else null),

 
Posted : 28/04/2019 1:25 pm
(@greenboy)
Posts: 25
Topic starter
 

Hi Catalin

Thank you so much fro the response - this makes an amazing difference in speed. 

Certainly one to remember for the future.

Thank you.

David

 
Posted : 01/05/2019 7:00 am
Share: