Forum Discussion

DuncanYeah's avatar
DuncanYeah
Helper III
1 year ago
Solved

Date Pairing

Dear All, I have two date columns from two different table.  Table 1 A  1 Mar  2 Mar 3 Mar 4 Mar  5 Mar  6 Mar  7 Mar  8 Mar   Table B  1 Mar  4 Mar  7 M...
  • SundarRaj's avatar
    1 year ago

    Hi DuncanYeah , another solution you can look at. I'll leave the image of output and M code used. Thanks!

    let
    Source = Excel.CurrentWorkbook(){[Name="Table5"]}[Content],
    MainTable = Table.TransformColumnTypes(Source,{{"Table A", type datetime}}),
    Dates = Excel.CurrentWorkbook(){[Name = "Table6"]}[Content][#"Table B "],
    Match = Table.AddColumn(MainTable,"Date", each try Dates{List.PositionOf(Dates,Record.ToList(_){0})} otherwise null),
    Table = Table.FillDown(Match,{"Date"})inTable