Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Date filters

Phill
8 - Asteroid

Hello, 

 

I'm trying to filter for everything within the next 2 months but all I'm getting is data for December.

 

Can anyone see what I'm doing wrong?

 

DateTimeAdd(DateTimeFirstOfMonth(),+2,"months")= DateTimeTrim([DateTime_Out],"months")

 

Thanks, 

 

Phill

15 REPLIES 15
atcodedog05
22 - Nova
22 - Nova

Hi @Phill 

 

Intresting scenario but not completely clear. If you provide a sample data and your workflow we can troubleshoot it for you.

joshuaburkhow
ACE Emeritus
ACE Emeritus

You want to actually use the DateTimeAdd() to do something like this: DateTimeAdd(DateTimeNow(),2,"month

Joshua Burkhow - Alteryx Ace | Global Alteryx Architect @PwC | Blogger @ AlterTricks
RolandSchubert
16 - Nebula
16 - Nebula

Hi  @Phill ,

 

what about this condition:

 

DateTimeTrim([DateTime_Out],"months") <= DateTimeAdd(DateTimeFirstOfMonth(), 2, "months")
AND
DateTimeTrim([DateTime_Out],"months") > DateTimeFirstOfMonth()

 

It should select all records within the next two months, excluding current month!

 

Let me know if it works for you.

 

Best,

 

Roland

atcodedog05
22 - Nova
22 - Nova

Hi @Phill ,

 

Here is a workflow for the task. It filters date within 2 months from this months first day both forward and backward.

 

Workflow :

atcodedog05_0-1601896493766.png

Keep only [Gap]<=2 for only forward months.

 

Hope this helps 🙂

 

If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

atcodedog05
22 - Nova
22 - Nova

Hi @Phill 

 

Change your condition into since you are looking for upcoming two months.

 

DateTimeAdd(DateTimeFirstOfMonth(),+2,"months") >= DateTimeTrim([DateTime_Out],"months")'

 

Your current :

DateTimeAdd(DateTimeFirstOfMonth(),+2,"months") = DateTimeTrim([DateTime_Out],"months")'

 

2 months from now is December.

 

Hope this helps 🙂

 

If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

Phill
8 - Asteroid

Thanks @atcodedog05 @RolandSchubert @joshuaburkhow 

 

I tried those suggestions but it still seems to be throwing out some odd dates. I'd have to make a separate data sample to share it so I'm not sure how useful that would be.

 

Basically the date data came in including a time so I ran it through a DateTime to convert it to YYYY-MM-DD. 

 

Then what I'm trying to do is add a filter so that whenever the workflow is run it takes all data that has a date within the next months of the date the workflow is running. So that's everything from 0/10/2020 to 05/12/2020.

 

atcodedog05
22 - Nova
22 - Nova

Hi @Phill ,

 

Are you getting any error or warning or just data logical issue like this.

Phill
8 - Asteroid

Hey @atcodedog05 

 

No errors its just not giving me within the next 2 months. I tried DateTimeAdd(DateTimeFirstOfMonth(),+2,"months") >= DateTimeTrim([DateTime_Out],"months") but that included all kinds of dates.

atcodedog05
22 - Nova
22 - Nova

Hi @Phill 

 

Try this

 

Edited:

 

(DateTimeAdd(DateTimeFirstOfMonth(),+2,"months") >= DateTimeTrim([DateTime_Out],"months"))

and (DateTimeTrim([DateTime_Out],"months")>=DateTimeFirstOfMonth())

Labels