Forum Discussion

Sbudd's avatar
Sbudd
Icon for Helper II rankHelper II
4 years ago
Solved

Joining on date range

Hi   I have 2 tables which i would like to join if within a date range. Table 1 is a Orders,  Account name, date, units and value ordered. Plus a measure to calculate Rev. Table 2 is AM Table, s...
  • johnt75's avatar
    johnt75
    4 years ago

    As long as there is no overlap between different people for the same account then you can add a column to Sales as

    AM Name = 
    var currentAccount = Sales[Account]
    var currentDate = Sales[Date]
    return CALCULATETABLE( SELECTCOLUMNS('AM Table', "AM Name", 'AM Table'[Name]),'AM Table'[Account] = currentAccount,
        'AM Table'[Start] <= currentDate && 'AM Table'[End] > currentDate )