ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Alteryx Designer Discussions

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

Joining Two Tables and applying where conditions

USER132991
5 - Atom

Hello Everyone,

 

I am trying to find a solution to below situation where I need an output based on merging 2 tables and applying some condition as below:

 

Table1: 

IDsSegmentStart DateEnd Date
AYellow1/1/202012/31/2020
ARed6/1/201912/31/2019
BBlue5/1/201812/31/2018

 

Table2:

IDDateClaims
A8/1/201913
A6/1/2020145
B1/1/201412

 

Final Output I want:

IDsSegmentClaims
AYellow145
ARed13
B<null>12

 

So basically the problem is like this: 

  • I need an output which would tell me that for all IDs in Table 2 how many claims were falling in between the dates (Start Date and End Date) in Table 1 and then append their Segment from Table 1
  • So, from the above tables for ID "B" since the "Date" in Table 2 is outside the range given for B in Table 1, therefore, it should display a blank in the "segment" column for B
  • Table 2 is my parent table i.e. I want data for all the IDs in Table 2 and if any ID is present in Table 1 and not in Table 2 then we can ignore that

 

Hope I am able to explain this. What should be the best way to handle such things in Alteryx?

 

Thanks in advance!

AbhilashR
14 - Magnetar
14 - Magnetar

Hi @USER132991, the approach in the attached solution is one way I think you can address your problem statement:

AbhilashR_0-1601394075035.png 

USER132991
5 - Atom

Thank you. This has worked flawlessly 🙂

StephJ
Community Manager
Community Manager

Hi @USER132991

 

Thank you for your question to the Community!

 

I moved your post to the Designer Discussions forum there you can ask anything technical about Designer. 

 

This article "Q&A: Where Do I Post My Questions?" should also help you out. 

 

Could you please mark @AbhilashR answer as "Solution" ? It will help other users. 

 

Thank you and have a very nice day!

Cheers,

 

Steph Jansen-Havreng
Labels