Alteryx Designer Discussions

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

Date filters

7 - Meteor

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

17 - Castor

Hi @Phill 

 

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

Alteryx Partner
Alteryx Partner

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
Alteryx Certified Partner
Alteryx Certified Partner

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

17 - Castor

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 😀👍

17 - Castor

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 😀👍

7 - Meteor

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.

 

17 - Castor

Hi @Phill ,

 

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

7 - Meteor

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.

17 - Castor

Hi @Phill 

 

Try this

 

Edited:

 

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

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

Labels