Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Exclude dates within last 6 months....

ShantanuDagar
8 - Asteroid

Hello,

 

I have a dataset with some date columns. 

 

I have to filter out rows for which that date is within last 6 months.

 

I am using formula DateTimeDiff(DateTimeNow(),[X],'months') > 6

 

But it is filtering out dates but it's not working quite fine. Showing dates which are in future as well with any difference of months.

 

Would be good if anyone can provide better formula.

 

The date type is yyyy-mm-dd.

4 REPLIES 4
BS_THE_ANALYST
15 - Aurora
15 - Aurora

@ShantanuDagar 
Okay, just to disect the problem:

BS_THE_ANALYST_0-1682495741155.png


This is how your formula is behaving.

In order to only find things within the last 6 months

BS_THE_ANALYST_1-1682495834419.png

I'd just add the AND clause to your filter:

BS_THE_ANALYST_2-1682495854994.png


Remember, if you want to access the "inclusion", just check your other output anchor in the Filter Tool:

BS_THE_ANALYST_3-1682496040935.png

 

 



 

 

 

All the best,
BS

LinkedIN

Bulien
TheUdbhav
8 - Asteroid

Hi @ShantanuDagar ,
If I understand your ask correctly, you want to filter the data from last 6 month i.. from 26th Oct 2022 to 26th April 2023 (Today's date).

I have attached my solution. First, I have calculated date 6 month prior today and then used filter. I have attached my solution.

Let me know if I can assist you further.


Thanks



  

anandakrishnan
8 - Asteroid

@ShantanuDagar 

You can use below formula :

[Today's Date] >= DateTimeAdd(DateTimeToday(), -6, "months")

 

 

binuacs
21 - Polaris

@ShantanuDagar your formula using the greater (>), which will always give you future date, I think you should use <= 

 

 DateTimeDiff(DateTimeNow(),[X],'months') <= 6

 

Labels
Top Solution Authors