let
Purch = Excel.CurrentWorkbook(){[Name="Purchase"]}[Content],
Prod = Excel.CurrentWorkbook(){[Name="Product"]}[Content],
tbl1 = Prod & Purch,
Group = Table.Group(tbl1, {"Date"}, {{"All", each _}}),
tbl2 = Table.AddColumn(Group, "Custom", each let lst = List.RemoveNulls([All][Purchase Qty]) in lst & List.Repeat({null}, Table.RowCount([All]) - List.Count(lst))),
tbl3 = Table.AddColumn(tbl2, "Custom1", each let lst = List.RemoveNulls([All][Location]) in lst & List.Repeat({null}, Table.RowCount([All]) - List.Count(lst))),
tbl4 = Table.AddColumn(tbl3, "Composite", each
Table.SelectRows(Table.FromColumns(List.FirstN(Table.ToColumns([All]), 4) & {[Custom]} &{[Custom1]}, Table.ColumnNames([All])), each List.Count(List.RemoveNulls(Record.ToList(_))) <>2)),
tbl5 = Table.RemoveColumns(tbl4,{"All", "Custom", "Custom1"}),
tbl6 = Table.ExpandTableColumn(tbl5, "Composite", {"Code", "Product", "Qty Used", "Purchase Qty", "Location"} ),
tbl7 = Table.TransformColumnTypes(tbl6,{{"Date", type date}}),
Result = Table.ReorderColumns(tbl7,{"Code", "Date", "Product", "Qty Used", "Purchase Qty", "Location"})
in
Result