// Table2
let
Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content]
in
Source
// Table1
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content]
in
Source
// Merge1
let
Source = Table.NestedJoin(Table2,{"Date"},Table1,{"Date"},"Table1",JoinKind.FullOuter),
Expand = Table.ExpandTableColumn(Source, "Table1", {"Date", "Part", "Price"}, {"Date.1", "Part", "Price"}),
Conditions = Table.AddColumn(Expand, "Custom", each if [Date] = null then [Date.1] else [Date]),
Sort = Table.Sort(Conditions,{{"Custom", Order.Ascending}}),
TSC = Table.SelectColumns(Sort,{"Custom", "Part", "Price"}),
FillD = Table.FillDown(TSC,{"Part", "Price"}),
FillU = Table.FillUp(FillD,{"Part", "Price"})
in
FillU
// Merge2
let
Source = Table.NestedJoin(Table2,{"Date"},Merge1,{"Custom"},"Merge1",JoinKind.LeftOuter),
Expand = Table.ExpandTableColumn(Source, "Merge1", {"Part", "Price"}, {"Part", "Price"}),
Distinct = Table.Distinct(Expand),
Type = Table.TransformColumnTypes(Distinct,{{"Date", type date}})
in
Type