Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Join by Multiple Fields with >= or <= Criteria

nickbecks
6 - Meteoroid

Apologies if this has been covered already. I searched and was unable to find a solution. I have two tables, one has Sale Transaction Date, Account Number and Sale Transaction Amount. The other table has the Account Number, Account Rep Name, Account Rep Begin Date and Account Rep End Date (dates are the periods that the Rep covered the account). Is there a way to Join Account Rep Name to the Sales Table using the Transaction Date and Account Number? 

 

Sales Table

Sale Transaction DateAccount NumberSale Transaction Amount
1/15/2019123410
7/15/2019123450
3/15/2020123420
5/10/20201234200
1/15/2019567810
7/15/2019567850
3/15/2020567820
5/10/20205678200

 

Account Rep Assignment Table

Account NumberAccount Rep NameAccount Rep Begin DateAccount Rep End Date
1234John D1/1/20196/30/2019
1234Amy C6/30/201912/31/2019
1234Jane D1/1/20204/15/2020
1234Bret T4/16/2020 
5678Alex D1/1/20196/30/2019
5678Paul C6/30/201912/31/2019
5678Alex D1/1/20204/15/2020
5678Alex D4/16/2020 

 

Desired output

Sale Transaction DateAccount NumberSale Transaction AmountAccount Rep Name
1/15/2019123410John D
7/15/2019123450Amy C
3/15/2020123420Jane D
5/10/20201234200Bret T
1/15/2019567810Alex D
7/15/2019567850Paul C
3/15/2020567820Alex D
5/10/20205678200Alex D
4 REPLIES 4
fmvizcaino
17 - Castor
17 - Castor

Hi @nickbecks ,

 

You can use the join + a filter tool to get that same result. 

fmvizcaino_0-1589241143158.png

 

 

 

Example attached.

Best,

Fernando Vizcaino

AbhilashR
15 - Aurora
15 - Aurora

Hi @nickbecks, I suggest joining the datasets on Account Number and then applying a Filter tool downstream to get your appropriate universe. Attached is an example to showcase my suggested approach.

AbhilashR_0-1589242286529.png

Hope this helps.

nickbecks
6 - Meteoroid

Thanks for this solution. As a followup to this, if the Account Rep Assignment Table only has Account Rep Begin Date, is there a way to calculate the End Date by using the Account Rep Begin Date from the preceding record for that same Account Number?

 

Account Rep Assignment Table

Account NumberAccount Rep NameAccount Rep Begin Date 
1234John D1/1/2019 
1234Amy C6/30/2019 
1234Jane D1/1/2020 
1234Bret T4/16/2020 
5678Alex D1/1/2019 
5678Paul C6/30/2019 
5678Alex D1/1/2020 
5678Alex D4/16/2020 
AbhilashR
15 - Aurora
15 - Aurora

Hi @nickbecks,

Yes, you can use the Multi-Row formula tool to compute the end date. The formula would look something like:

IIF(
ISNULL([Row+1:AccRepBeginDt]),
DateTimeToday(),
[Row+1:AccRepBeginDt]
)

 Attached is an implementation of the solution as well.

Labels