We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Find the Highest Gift in a range that is specific to each set

jcoleman13
6 - Meteoroid

I am struggling to find a the Highest Gift in an 18 month period.  Here is the data set example.  

 

Each row is a gift and the date it was made.  I need to find the highest gift in an 18 month range.  So for ID 1, even though the $100 is the highest of the 4 gifts, its not the highest in an 18 month range.  The range starts from their last gift date and goes 18 months back... so ID 1's highest gift in their 18 month window is actually $50.  For ID 6 it's $45

IDGift DateGift Amount
11/1/1981100
16/2/199725
112/4/199850
11/5/199925
21/1/202530
22/1/202530
23/1/202560
24/1/202530
31/6/202175
35/1/202175
38/7/2022100
45/8/2024100
59/2/202258
510/6/202325
612/9/202060
62/8/202345
65/1/202425

 

I used a summarize tool to get the most recent gift date, and then calculate 18 months from there... so i have a range... but i cant figure out how to pull between that range.  Any ideas?

4 REPLIES 4
Zampy
7 - Meteor

Since you have your date range, join the starting and end dates of that range back to your initial list using ID and then filter date to make sure it's between those two points.  After that, just take the highest value for your given ID.  

jcoleman13
6 - Meteoroid

But how do i filter it when the two dates vary between each row?

Zampy
7 - Meteor

Using ID 1 as an example, your date range should be Max = 1/5/1999 and Min = 7/5/1998 if I math correctly.  After a join, your table would look like this:

 

IDGift DateGift AmountStart DateEnd Date
11/1/19811007/5/19981/5/1999
16/2/1997257/5/19981/5/1999
112/4/1998507/5/19981/5/1999
11/5/1999257/5/19981/5/1999

 

Then your filter would read as Start Date <= Gift Date  AND Gift Date <= End Date.  This would result in your table remaining as follows:

 

IDGift DateGift AmountStart DateEnd Date
112/4/1998507/5/19981/5/1999
11/5/1999257/5/19981/5/1999

 

And from there you can pull your Max Amount

jcoleman13
6 - Meteoroid

Thank you!!! That did it!

Labels
Top Solution Authors