Forum Discussion
Query runs very slow with Table.SelectRows
- 5 years ago
Hello Coxy_CMV
you are here maneuvring a lot with tables and that could it makes slow. However try this more compact code, if it has some impact on the performance and let me know. By the way... how many rows you have in #"WIP"-table?
let Source = Table.NestedJoin(#"WIP", {"VIN"}, #"ROColl", {"VIN"}, "ROColl", JoinKind.LeftOuter), #"Added Custom" = Table.AddColumn(Source, "Matching Open RO's", each let currentRO = [Job No], currentSales = [Sale Type] in Text.Combine(Table.SelectRows([ROColl], each [Job Number] <> currentRO & " - " & currentSales)[Job Number],"#(lf)" )), #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"ROColl"}), #"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Matching Open RO's", type text}}) in #"Changed Type"Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello Coxy_CMV
you are here maneuvring a lot with tables and that could it makes slow. However try this more compact code, if it has some impact on the performance and let me know. By the way... how many rows you have in #"WIP"-table?
let
Source = Table.NestedJoin(#"WIP", {"VIN"}, #"ROColl", {"VIN"}, "ROColl", JoinKind.LeftOuter),
#"Added Custom" = Table.AddColumn(Source, "Matching Open RO's", each let currentRO = [Job No], currentSales = [Sale Type] in
Text.Combine(Table.SelectRows([ROColl], each [Job Number] <> currentRO & " - " & currentSales)[Job Number],"#(lf)" )),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"ROColl"}),
#"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Matching Open RO's", type text}})
in
#"Changed Type"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy