Start Free Trial

Alteryx Designer Desktop Discussions

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

Comparing dates within a range

Grim
5 - Atom

Hi Folks !

I am working on a project where i have one file with a unique ID within different date ranges. The ask is to group the IDs basis the date ranges and count the unique sets. The complexity is that if start date of two sets with similar ID is within 3 days, then the sets can be counted as one, similarly if the end date of two sets with same IDs is within 2 days then they can be counted as one.

Example:

 

Sample Data:

Set #IDStart DateEnd Date

Original count

112023-11-23 2023-11-291
212023-10-132023-10-151
312023-11-252023-11-301
412023-11-262023-11-311
512023-11-262023-12-041

 

Expected Output:

Set#IDStart DateEnd Date

Final Count

Inference
112023-11-23 2023-11-292Here 2 sets of ID '1' are clubbed i.e. Set 1 and Set 3 hence count increased to 2. The reason they are clubbed is because the start date is within a 3 day range of start date of set 1 and does not exceed the end date by 2 days of set 1
212023-10-132023-10-151No date range match
412023-11-262023-11-311Start date outside 3 days range
512023-11-262023-12-041End date outside 2 days range

 

Note: The earliest date from a set of similar ID is  taken as start date and the last date of that same set is considered.

 

Please share your thoughts on how to accomplish this. I have huge files of such data sets

 

0 REPLIES 0
Labels
Top Solution Authors