Alteryx Designer Desktop Discussions

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

Deriving values from another table based on Date Range

Venkatasai541
6 - Meteoroid

Hi Guys,

 

I have two tables as follows:

 

Table 1 - Entries posted by Users

Document NumberPosting DateUser Name
190000000001/04/20191190
190000000120/04/20191190
190000000201/04/20195163
190000000310/05/20195163
190000000401/04/20191196
190000000525/04/20191196
190000000610/05/20191196

 

Table 2 - User Type Changes

User       Date      From ValueTo Value
119015/04/2019AB
516330/04/2019BA
119615/04/2019BA
119601/05/2019AB

 

I want a new column in table 1 as "User Type" and bring the same from Table 2 as "A" or "B" based on the applicable date range.

 

Output Table should be as follows:

Document NumberPosting DateUser NameUser Type
190000000001/04/20191190A
190000000120/04/20191190B
190000000201/04/20195163B
190000000310/05/20195163A
190000000401/04/20191196B
190000000525/04/20191196A
190000000610/05/20191196B

 

Does anyone have a solution to this?

 

(Attached the input files for your reference)

5 REPLIES 5
ChrisTX
15 - Aurora

Here are a few related posts:

 

Alteryx Weekly Challenge #1: Join to Range

It is a good example to show the usefulness of the generate rows tool.

https://community.alteryx.com/t5/Weekly-Challenge/Challenge-1-Join-to-Range/td-p/36621

 

Using Advanced Join macro

https://community.alteryx.com/t5/Engine-Works-Blog/Advanced-Join-Macro/ba-p/2355

 

Community > Designer > Browse Knowledge > Advanced Join: value from one file is between

https://community.alteryx.com/t5/Alteryx-Knowledge-Base/Advanced-Join-value-from-one-file-is-between...

 

Using Advanced Join Macro for Large Data Set

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Using-Advanced-Join-Macro-for-Large-Da...

 

echuong1
Alteryx Alumni (Retired)

You can use a Join tool to bring over the From, To, and Date values. From there, you can use a formula tool to determine if the To or From value should be used by comparing the dates.

 

See attached for an example. Let me know if this works for you!

 

echuong1_0-1594145871307.png

 

Venkatasai541
6 - Meteoroid

@ChrisTX, thanks for your links.

 

@echuong1, thanks! Your approach works only if there is a single user type change instance. In the given example, for user "1196" (multiple user type change instances) the required output should be:

Document NumberPosting DateUser NameUser Type
190000000401/04/20191196B
190000000525/04/20191196A
190000000610/05/20191196B

 

Whereas as per your workflow, it is coming as:

Document NumberPosting DateUser NameUser Type
190000000401/04/20191196B
190000000401/04/20191196A
190000000525/04/20191196A
190000000525/04/20191196A
190000000610/05/20191196A
190000000610/05/20191196B

 

-

Venkat

 

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @Venkatasai541,

 

I think this is what you're trying to achieve?

 

Jonathan-Sherman_0-1594153746072.png

 

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.

 

Regards,

Jonathan

Venkatasai541
6 - Meteoroid

@Jonathan-Sherman, thanks a lot for your support.

 

The workflow is working perfectly fine.

 

-

Venkat

Labels