let
ZQM14 = Table.NestedJoin(ZQM14, {"Vendor"}, tbl_VendorGroup, {"Vendor Code"}, "tbl_VendorGroup", JoinKind.LeftOuter),
#"Expanded tbl_VendorGroup" = Table.ExpandTableColumn(ZQM14, "tbl_VendorGroup", {"Vendor Group"}, {"tbl_VendorGroup.Vendor Group"}),
ZQM14.VG = Table.ReplaceValue(#"Expanded tbl_VendorGroup",null,"Other",Replacer.ReplaceValue,{"tbl_VendorGroup.Vendor Group"}),
Merge.WC = Table.NestedJoin(ZQM14.VG, {"Unit to be insp."}, tbl_WorkCentreTable1, {"Work Centre"}, "tbl_WorkCentreTable1", JoinKind.LeftOuter),
#"Expanded tbl_WorkCentreTable1" = Table.ExpandTableColumn(Merge.WC, "tbl_WorkCentreTable1", {"Work Centre Name"}, {"tbl_WorkCentreTable1.Work Centre Name"}),
ZQM14.WC = Table.ReplaceValue(#"Expanded tbl_WorkCentreTable1",null,"Omitted",Replacer.ReplaceValue,{"tbl_WorkCentreTable1.Work Centre Name"}),
Merge.ZQM12 = Table.NestedJoin(ZQM14.WC, {"Notification"}, ZQM12, {"Notification"}, "ZQM12", JoinKind.LeftOuter),
#"Expanded ZQM12" = Table.ExpandTableColumn(Merge.ZQM12, "ZQM12", {"Reference number"}, {"ZQM12.Reference number"}),
ZQM14.ZQM12 = Table.ReplaceValue(#"Expanded ZQM12",null,"",Replacer.ReplaceValue,{"ZQM12.Reference number"}),
Merge.COOIS = Table.NestedJoin(ZQM14.ZQM12, {"ZQM12.Reference number"}, COOIS, {"Order"}, "COOIS", JoinKind.LeftOuter),
#"Expanded COOIS" = Table.ExpandTableColumn(Merge.COOIS, "COOIS", {"Rework Hours"}, {"COOIS.Rework Hours"}),
ZQM14.COOIS = Table.ReplaceValue(#"Expanded COOIS",null,0,Replacer.ReplaceValue,{"COOIS.Rework Hours"}),
Merge.LTH = Table.NestedJoin(ZQM14.COOIS, {"ZI33 H"}, LongText_Header, {"Object Reference"}, "LongText_Header", JoinKind.LeftOuter),
#"Expanded LongText_Header" = Table.ExpandTableColumn(Merge.LTH, "LongText_Header", {"Header Long Text"}, {"LongText_Header.Header Long Text"}),
ZQM14.LTH = Table.ReplaceValue(#"Expanded LongText_Header",null,"Long Text Missing",Replacer.ReplaceValue,{"LongText_Header.Header Long Text"}),
Merge.LTI = Table.NestedJoin(ZQM14.LTH, {"ZI33 I"}, LongText_Items, {"Object Reference"}, "LongText_Items", JoinKind.LeftOuter),
#"Expanded LongText_Items" = Table.ExpandTableColumn(Merge.LTI, "LongText_Items", {"Items Long Text"}, {"LongText_Items.Items Long Text"}),
ZQM14.LTI = Table.ReplaceValue(#"Expanded LongText_Items",null,"Long Text Missing",Replacer.ReplaceValue,{"LongText_Items.Items Long Text"}),
Merge.LTC = Table.NestedJoin(ZQM14.LTI, {"ZI33 C"}, LongText_Causes, {"Object Reference"}, "LongText_Causes", JoinKind.LeftOuter),
#"Expanded LongText_Causes" = Table.ExpandTableColumn(Merge.LTC, "LongText_Causes", {"Cause Long Text"}, {"LongText_Causes.Cause Long Text"}),
ZQM14.LTC = Table.ReplaceValue(#"Expanded LongText_Causes",null,"Long Text Missing",Replacer.ReplaceValue,{"LongText_Causes.Cause Long Text"})
in
ZQM14.LTC