Forum Discussion

chuyiyi's avatar
chuyiyi
New Member
2 years ago
Solved

date period

Dear all, good day    Two tables: Table 1 has these fields , Start Date 、End Date 、Location. Table 2 has Date Filed , how to estimate the date in which period and get the Location Value.   Plea...
  • AlienSx's avatar
    2 years ago

    Hello, chuyiyi 

    let
        Table1 = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        Table2 = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
        combo = Table.RenameColumns(Table1, {"Start Date", "Order Date"}) & Table.AddColumn(Table2, "mark", each 1),
        sort = Table.Sort(combo,{{"Order Date", Order.Ascending}, {"mark", Order.Descending}}),
        fdown = Table.FillDown(sort,{"Location"}),
        filter = Table.SelectRows(fdown, each ([mark] = 1)),
        select = Table.SelectColumns(filter,{"Location", "Order Date"})
    in
        select