Alteryx Designer Desktop Discussions

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

Filter for next available day

agrawaluk
8 - Asteroid

Hi All,

 

I have a date column as follows:

agrawaluk_0-1586272515141.png

I am looking to filter date for day after tomorrow (dynamic) but since here 04/09/2020 is not present it should look at next day and if that is also not available then next day and so on. So in this case I should get 04/13/2020. 

 

I am trying to use this formula:

agrawaluk_1-1586272667834.png

Let me know if this is wrong or if there is any other way to do this. Thank you!

 

9 REPLIES 9
BrandonB
Alteryx
Alteryx

What about a filter tool that says [Settlement Date] > DateTimeAdd(DateTimeNow(), 1, "Days") and then a sample tool afterwords where it picks N number of records with N=1. If the dates are already sorted in order the filter will only pass through the days after tomorrow and then the sample tool will only pass through the next available record. 

agrawaluk
8 - Asteroid

Hey Brandon, 

 

Thanks for your response. This would work, but I missed a major detail to add to my problem, there is another column "ID" which has the same dates. So in this case sample wouldn't work exactly. 

 

Sample data of what I am looking at 

 

IDDate
14/7/2020
14/8/2020
14/13/2020
14/14/2020
14/15/2020
24/7/2020
24/8/2020
24/13/2020
24/14/2020
24/15/2020

 

What I want the filter to do in this case:

14/13/2020
24/13/2020

 

 

BrandonB
Alteryx
Alteryx

The good news is that you can actually accomplish this using the same methodology that I suggested above but with one more adjustment. In the Sample tool you can "Group By" a field. In this case you would group by your ID field by checking the box in the Sample tool and it would pull the first date (assuming they are sorted) from every group of ID's. 

agrawaluk
8 - Asteroid

With the group by function, it totally works. However, I just tried it and DateTimeAdd(DateTimeNow(), 1, "Days") would give no records. I am attaching sample wf. Is there something I was missing?

BrandonB
Alteryx
Alteryx

[Settlement Date] > ToDate(DateTimeAdd(DateTimeToday(), 1, "days"))

BrandonB
Alteryx
Alteryx

Also make sure that Settlement Date is in an actual date data type

agrawaluk
8 - Asteroid

Hey @BrandonB 

 

I tried that as well. But I don't follow how the sample tool would be used. Can you please help me with the workflow? You may use the workflow from my previous response. Really appreciate your time. Thanks

grossal
15 - Aurora
15 - Aurora

I think Brandon means something like this: 

 

grossal_0-1586293650862.png

 

You first reset your filter to what he originally suggested:

 

grossal_1-1586293676010.png

 

And than use a sample + group by option to always get the first per ID.

 

grossal_2-1586293710064.png

 

I'll attach your modified workflow.

 

Best

Alex

 

 

 

agrawaluk
8 - Asteroid

Ah! Thanks for sharing this. This totally works!

Labels