Forum Discussion

ShNBl84's avatar
ShNBl84
Icon for Advocate II rankAdvocate II
7 years ago
Solved

Merge tables with all data despite longer date ranges

Hey heros,   I have two large tables that I am trying to combine. I have a table that shows the history of items sold (historical only) and the forecasted sales (includes past and future dates). S...
  • ShNBl84's avatar
    7 years ago

    It isn't the prettiest solution, but it is the best I could do.

     

    I duplicated the Forecast table and filtered one to be any date before today (to match the dates in the Sales table) and the other to be today or later.

    To make the filter I used: #"Past Only" = Table.SelectRows(#"(previous line)", each [Date] < Date.From(DateTime.LocalNow()))

    I then LeftOuter joined the Forecast (Past) table with Sales.

    I crossjoined Forecast (Future) with a table that is a unique list of store names by adding the store table as a column to the Forecast (Future) table. 

    I then appended the Forecast (Future) with store names table to the Sales table.

     

    That leaves me with a Forecast (Future) table with many more rows than I wanted, but it is far less than crossjoining the entire table.