Forum Discussion

Swilson2112's avatar
Swilson2112
Frequent Visitor
4 years ago
Solved

Compare closest date between 2 tables

EXAMPLE of tables and desired result.   TABLE 1                                        Transaction #.      Part#                           Invoice Date. 1.                             A          ...
  • AlexisOlson's avatar
    AlexisOlson
    4 years ago

    What I suggested only adds two columns to Table1 and one of them (the table-valued column) can be removed after the new custom column has been defined. Create a new blank query and paste the M code I provided over the existing code in the Advanced editor to examine the applied steps to understand more easily.

     

    You can also do this purely in DAX without doing any table merges but you asked in the Power Query forum so I have a Power Query answer. You can also add the custom column in Power Query without doing a merge first but I think it might be too slow given your millions of rows.