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

Counting number of days in a date range

Altamush_Khwaja
5 - Atom

I'm trying to break down start_date end_date combination into a monthly range with an additional wrinkle. The additional step is I need to break down monthly ranges into smaller chunks based on entries in a second table. 

So I have a list of records like so 

idstart_dateend_date
110/15/202011/08/2020
210/25/202011/23/2020
311/23/202012/05/2020

 

I have another table with a list of dates, which represents change in interest rate:

change_date
10/27/2020
12/03/2020

 

Based on this, the time windows for me would be:

Oct_1 - 10/1/2020 - 10/27/2020

Oct_2 - 10/28/2020 - 10/31/2020

Nov - 11/1/2020 - 11/18/2020

Dec_1 - 12/1/2020 - 12/3/2020

Dec_2 - 12/4/2020 - now

 

So, my output would need to be 

idOct_1Oct_2NovDec_1Dec_2
11258  
2253  
3  82

 

Using the excellent linked solution, I was able to get the above to work if the change date happens once a month. I am getting in trouble when trying to generalize to more change dates in a month. 

 

I would appreciate any ideas on how to do that.

2 REPLIES 2
AkimasaKajitani
17 - Castor
17 - Castor

Here is my solution for you.

 

AkimasaKajitani_0-1607566882249.png

 

In combining the two data streams, I simply combined them by Date.
As a pre-processing, it is needed to split the change date into separate dates.

 

Input:

AkimasaKajitani_3-1607567144213.png

 

I changed this input.

AkimasaKajitani_2-1607567131994.png

 

Output:

AkimasaKajitani_1-1607567072011.png

 

Altamush_Khwaja
5 - Atom

Thank you so much! This works! 

Labels
Top Solution Authors