Forum Discussion

GunnerJ's avatar
GunnerJ
Icon for Post Patron rankPost Patron
2 years ago
Solved

Show repeat customers within a week

I need to flag tickets that are for the same customer if that customer had a previous ticket within a week.

 

In Table A I have Account Number and in Table B I have the Ticket Number as well as the Ticket Date. 

 

My issue is that when I try to use something like EARLIER I can only reference one table. So I can say acct = earlier acct but I than can't say ticket date <= earlier ticket date and vise versa. 

 

In my head the solution would look something like this where I get a true statement if the same customer had a repeat ticket within 7 days. 

Calculate 
      count(Ticket_ID),
            Account_Num = Earlier(Account_Num),
            DateDiff(Ticket_Date, Earlier(Ticket_date), Day) <=7
             ) > 0

Any help or suggestions are appreciated.