Forum Discussion

DJ1977's avatar
DJ1977
Icon for Helper I rankHelper I
5 years ago
Solved

Add column for campaign within daterange

Hello. I have a small case here that I can not find a solution to by searching the forum here. Hope someone can give me a tip. I have a model with two tables, A & B, among several.        ...
  • Ashish_Mathur's avatar
    5 years ago

    Hi,

    This calculated column formula works

    =CALCULATE(VALUES(Table1[Campaign]),FILTER(Table1,Table1[Customer]=EARLIER(Table2[Customer])&&Table1[Product ID]=EARLIER(Table2[Product ID])&&Table1[Start date]<=EARLIER(Table2[Salesdate])&&Table1[End date]>=EARLIER(Table2[Salesdate])))

    Hope this helps.