Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Complex Join

Rhael012
6 - Meteoroid

I have a problem joining two of my dataset. One main problem is there is no primary key for the two dataset since there are duplicate records with both sets. I'm trying to get supplemental data from the Table 2 to the Table 1. 

 

Table 1:

RecordDetails
1 
1 
2 
2 


Table 2:

RecordDetails
1Detail 1
2Detail 2
2Detail 3
2Detail 4
3Detail 5

 

Result should be like this:

RecordDetails
1Detail 1
1 
2Detail 2
2Detail 3

 

Thanks for the help.

14 REPLIES 14
apathetichell
19 - Altair

@Rhael012type @ and then choose the name from a dropdown. That's the easiest way. If you have some sample data with a date/transaction key - I can make you a mock worklow - or I'm sure @Qiu can when he wakes up.

Rhael012
6 - Meteoroid

@apathetichell, here is the data that I can share.

Current Day data:

UniqueKeyRecordIDDetail 1Detail 2Transaction DateFindings
 1Account 1Transaction 14/8/2022 
 2Account 1Transaction 14/8/2022 
 3Account 2Transaction 14/11/2022 
 4Account 2Transaction 24/11/2022 
 5Account 2Transaction 14/8/2022 
 6Account 3Transaction 14/11/2022 
 7Account 3Transaction 24/11/2022 
 8Account 4Transaction 14/8/2022 
 9Account 5Transaction 14/8/2022 
 10Account 6Transaction 14/8/2022 


Previous Day Data:

UniqueKeyRecordIDDetail 1Detail 2Transaction DateFindings
04082211Account 1Transaction 14/8/2022Findings 1
04082222Account 1Transaction 14/8/2022Findings 2
04082233Account 2Transaction 24/8/2022Findings 3
04082244Account 2Transaction 14/8/2022Findings 4
04082255Account 3Transaction 14/8/2022Findings 5
04082266Account 3Transaction 24/8/2022Findings 6
04082277Account 3Transaction 14/8/2022Findings 7
04082288Account 3Transaction 24/8/2022Findings 8
04082299Account 4Transaction 14/8/2022Findings 9
0408221010Account 4Transaction 14/8/2022Findings 10
0408221111Account 5Transaction 14/8/2022Findings 11
0408221212Account 5Transaction 14/8/2022Findings 12
0408221313Account 6Transaction 14/8/2022Findings 13
0408221414Account 6Transaction 24/8/2022Findings 14
0408221515Account 6Transaction 14/8/2022Findings 15

 


Desired Result:

UniqueKeyRecordIDDetail 1Detail 2Transaction DateFindings
04082211Account 1Transaction 14/8/2022Findings 1
04082222Account 1Transaction 14/8/2022Findings 2
 3Account 2Transaction 14/11/2022 
 4Account 2Transaction 24/11/2022 
04082235Account 2Transaction 14/8/2022Findings 3
 6Account 3Transaction 14/11/2022 
 7Account 3Transaction 24/11/2022 
040822108Account 4Transaction 14/8/2022Findings 9
040822119Account 5Transaction 14/8/2022Findings 11
0408221310Account 6Transaction 14/8/2022Findings 13

 


From here, as you can see, for the current day, we can identify the transactions that is generated only this day. Thus, we also need to create a UniqueKey for the Transactions that has no UniqueKey. 

Hope this will be helpful.

apathetichell
19 - Altair

without a uniquekey in the current day dataset this won't work. You'll get hit with dimensional issues and get multiple entries for the same identifier.

 

let me explain - say you are trying to join account 1/transaction 1 from 4/8/2022 from current day - without a unique id it will not know which entry to match vs previous day - solution it will match both. This is standard SQL. Excel uses fake matching via vlookup (a match first strategy) but that is just an artificial excel strategy.

 

If you have unique transaction id in both this becomes straight forward.

CathyS_Slalom
9 - Comet

@Rhael012 I agree with @Qiu and @apathetichell that Tile is a helpful tool on this type of problem. I did a test and you can just expand your unique and groupby selection to the keys that you want to join two tables on, i.e. Detail 1, Detail 2, and Transaction Date. See attached workflow. 

 

One thing that I'm not sure is why from your desired result that you mapped Findings 3 not Findings 4. We can change the workflow based the logic why you want "Findings 3" assign to this record.

04082235Account 2Transaction 14/8/2022Findings 3

 

 

Rhael012
6 - Meteoroid

Hi @cathyshi525. This is working perfectly. Thank you so much for answering my concern! 

Labels
Top Solution Authors