Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Taking the min with condition

table 1 have email sent date:

table 2 has when they visited the website and they could have visited multiple times.

The two tables have ID relationship.

 

I would like to pull the first login date from table 2 that occurs after the sent date into table one.  Know that logins could happen before or after the email sent, but I would like to know who log in within 7 days after the email sent out so that we could measure campaign effectiveness.   

 

My approach is to take the min(date) from table 2 and call it into a column on table 1, but how do I add a condition to make sure the min(date) be greater than the send date.  

 

Thank you very much for any help! 

  • Hi,

    Write this calculated column formula in Table1.  You will need to change the Table and column names

    =CALCULATE(MIN(Table2[Date]),FILTER(Table2,Table2[ID]=EARLIER(Table1[ID])&&Table2[Date]>EARLIER(Table1[Date])))

    Hope this helps.

9 Replies

  • Hi,

    Write this calculated column formula in Table1.  You will need to change the Table and column names

    =CALCULATE(MIN(Table2[Date]),FILTER(Table2,Table2[ID]=EARLIER(Table1[ID])&&Table2[Date]>EARLIER(Table1[Date])))

    Hope this helps.

    • Anonymous's avatar
      Anonymous
      Not applicable

      =CALCULATE(MIN(Table2[Date]),FILTER(Table2,Table2[ID]=EARLIER(Table1[ID])&&Table2[Date]>EARLIER(Table1[Date])))

       

      When filtering table 2, including table 1 causes error.  Please advise (red text above).

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Hi,

        I cannot figure out the mistake there.  Share the link from where i can download the PBI file with my formula already written there.  I will try to correct for the error.