(question from the web)
How do we update values in Table A using the Values of Table B and keep the rest as they are?
TABLE A TABLE B Result SiteId date Value 1 Value 2 Value 3 SiteId date Value2 SiteId date Value 1 Value 2 Value 3 1 01/01/2020 5 20 500 1 01/01/2020 25 1 01/01/2020 5 25 500 1 02/05/2020 6 60 100 3 01/01/2021 73 1 02/05/2020 6 60 100 3 01/01/2021 2 85 250 3 01/01/2021 2 73 250 5 01/01/2020 6 14 566 5 01/01/2020 6 14 566
Code:let SourceA = Excel.CurrentWorkbook(){[Name="TableA"]}[Content], SourceB = Excel.CurrentWorkbook(){[Name="TableB"]}[Content], Join = Table.NestedJoin(SourceA, {"SiteId", "date"}, SourceB,{"SiteId", "date"}, "Table", JoinKind.LeftOuter), Expand = Table.ExpandTableColumn(Join, "Table", {"Value2"}, {"Value2"}), IF = Table.AddColumn(Expand, "Custom", each if [Value2] = null then [Value 2] else [Value2]), TSC = Table.SelectColumns(IF,{"SiteId", "date", "Value 1", "Custom", "Value 3"}), Ren = Table.RenameColumns(TSC,{{"Custom", "Value 2"}}), Type = Table.TransformColumnTypes(Ren,{{"date", type date}}) in Type



Reply With Quote
Bookmarks