@Krays23,
I think there are some issues with your last step:
#“Added ListOfMaterials” = Table.AddColumn(#“Expanded Price Lookup (MM60)”, “Item in List of Materials”, each Table.Contains( TableBufferListOfMaterials , [ItemKey= [ItemKey]]), type logical)
- I believe your [Material Number] is the equivalent of the field I had called [ItemKey] if so you’d need to substitute that, since you haven’t supplied code for the query: #“Bom Materials (Anca & MM60 Merge)” please check the fieldname there as well. I have assumed these fields are named exactly the same.
- In the final step you don’t reference #“Replaced Value1” but the step before that, which means #“Replaced Value1” won’t be applied at all.
I’ve tried adjusting it, although that’s a bit more tricky outside the Advanced Editor and without being able to see the applied steps but I believe it’s okay
let
Source = ZMDispodat,
#“Removed Duplicates” = Table.Distinct(Source, {“Material Number”}),
#“Reordered Columns” = Table.ReorderColumns(#“Removed Duplicates”,{“Material Number”, “Product Hierarchy”, “Material Description”, “Material Group”, “Material Type”, “Unit of Measure”, “Purchasing Group Number”, “ABC Indicator”, “MRP Type”, “MRP Controller Number”, “Planned Delivery Time”, “GR Processing Time”, “In House Production Time”, “Safety Time”, “Lot Type”, “Safety Stock”, “Reorder Point”, “Maximum Stock Level”, “Fixed Lot Size”, “Minimum Remainig Shelf Life”, “Total Shelf Life”, “Batch Management”, “Old Material Number”, “Planning Strategy Group”, “Created On”, “Created By”, “Last Change”, “Changed By”}),
#“Removed Other Columns” = Table.SelectColumns(#“Reordered Columns”,{“Material Number”, “Product Hierarchy”, “Material Description”, “Material Group”, “Material Type”, “Unit of Measure”, “Purchasing Group Number”, “ABC Indicator”, “MRP Type”, “MRP Controller Number”, “Lot Type”, “Safety Stock”, “Reorder Point”, “Maximum Stock Level”, “Batch Management”, “Planning Strategy Group”}),
TableBufferListOfMaterials = Table.Buffer(#“Bom Materials (Anca & MM60 Merge)”),
#“Added ListOfMaterials” = Table.AddColumn(#“Removed Other Columns”, “Item in List of Materials”, each Table.Contains( TableBufferListOfMaterials , [Material Number= [Material Number]]), type logical),
#“Inserted Merged Column” = Table.AddColumn(#“Removed Other Columns”, “Merged”, each Text.Combine({[Material Number], " - ", [Material Description]}), type text),
#“Renamed Columns” = Table.RenameColumns(#“Inserted Merged Column”,{{“Merged”, “Material Number & Name”}}),
#“Merged Queries” = Table.NestedJoin(#“Renamed Columns”, {“Product Hierarchy”}, #“Project Codes (Dan)”, {“Project Code”}, “Project Codes (Dan)”, JoinKind.LeftOuter),
#“Expanded Project Codes (Dan)” = Table.ExpandTableColumn(#“Merged Queries”, “Project Codes (Dan)”, {“Project Name”, “Project Code & Name”}, {“Project Codes (Dan).Project Name”, “Project Codes (Dan).Project Code & Name”}),
#“Renamed Columns1” = Table.RenameColumns(#“Expanded Project Codes (Dan)”,{{“Project Codes (Dan).Project Name”, “Project Name”}, {“Project Codes (Dan).Project Code & Name”, “Project Code & Name”}}),
#“Replaced Value” = Table.ReplaceValue(#“Renamed Columns1”,null,“No product hierarachy set”,Replacer.ReplaceValue,{“Project Name”, “Project Code & Name”}),
#“Merged Queries1” = Table.NestedJoin(#“Replaced Value”, {“Material Number”}, #“Price Lookup (MM60)”, {“Material Number”}, “Price Lookup (MM60)”, JoinKind.LeftOuter),
#“Expanded Price Lookup (MM60)” = Table.ExpandTableColumn(#“Merged Queries1”, “Price Lookup (MM60)”, {“Converted Price”}, {“Converted Price”}),
#“Replaced Value1” = Table.ReplaceValue(#“Expanded Price Lookup (MM60)”,null,0,Replacer.ReplaceValue,{“Converted Price”})
in
#“Replaced Value1”
Let me know if this helped