Alteryx Designer Desktop Discussions

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

Find the closest date

AbdullahMansour90
7 - Meteor

I have this sample dataset 

 

I wanna check from the column rate date the nearest dates to the dates in April and October column, is there anyway to do that? 

 

Thanks in advance. 

AbdullahMansour90_0-1611251664506.png

 

2 REPLIES 2
phoebe_kelley
9 - Comet

@AbdullahMansour90  are you trying to get whether the April or October date is closest to the rate date? I am not clear on the question. If that is what you are trying to do, you could use a formula tool with "if datetimediff(october date, rate date, "days") > datetimediff(april date, rate date, "days") then "October" else "April" endif... or something like that?

AngelosPachis
16 - Nebula

Hi @AbdullahMansour90 ,

 

If I understand the requirements correctly, you want to find the rate date which is closest to April/October Days for each year?

 

If yes, then the following workflow should work for you

 

AngelosPachis_0-1611253514723.png

 

Essentially you are estimating the difference of each rate day from the April and October columns and then finding the minimum values for each year through the summarize tool.

 

Finally, it is just a matter of putting everything back together and creating the flag for the minimum date.

 

Hope that helps, let me know if that worked for you.

 

Regards,

 

Angelos

Labels
Top Solution Authors