Free Trial

Alteryx Designer Desktop Discussions

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

Days between two dates within one year

Andrzej
8 - Asteroid

Hey,

 

I have three columns

start_date

end_date

run_year

 

I want to count the number of days within one year (run_year) between two dates (start day and end_day).

For example, if the start date is 30/12/2017 and the end date is 14/01/2019, I want to get

2 days for run_year = 2017 

365 days for run_year = 2018

14 days for run_year = 2019

 

Of course, the year of start_date can be equal to the year of end_date.

 

I have found a similar solution for number of days within one month between two dates, but it uses DateTimeLastOfMonth and DateTimeFirstOfMonth function, and I cannot find sth similar for years.

 

Thanks!

3 REPLIES 3
RolandSchubert
16 - Nebula
16 - Nebula

Hi @Andrzej ,

 

I've  created a sample workflow, hoefully it solves your problem.

 

30-09-_2019_10-06-18.png

 

Best regards

 

Roland

Andrzej
8 - Asteroid

Thanks, it is working 🙂 

JoeS
Alteryx Alumni (Retired)

Hi @Andrzej 

 

I have built the logic into a workflow here:

 

Workflow.png

 

I have built the logic up using filters instead of an if statement to check the process makes sense. 

 

You can combine into one formula if you wish.

 

Edit: **bleep** people on the community are so quick, if you get distracted in building a solution it's already answered! Different logic applied though. 

Labels
Top Solution Authors