Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Filtering on past 6 months data

RogerA
8 - Asteroid

Hi, i am trying to filter my data to the previous 6 months, from "today's date".

 

So far i have used the datetimenow() to create a new field called "Today's Date", and now i am trying to figure out how to filter my records to only show the previous 6 months based upon the date in this field.

 

Is this the right way to go about filtering my data to only show past 6 months based upon the date i run my report?

 

Thanks

4 REPLIES 4
LordNeilLord
15 - Aurora

Hey @RogerA

 

In your filter tool you can add the following to filter on the last 6 months;

 

DateTimeAdd([Your Date], DateTimeToday(), -6, "months")

Neil

RogerA
8 - Asteroid

Thanks, so this is what it looks like with my actual field added into the filter:

 

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

 

"Today's Date" is the new date field i have added into the data.  But i am getting the message "Wrong number of parameters for the function "DATETIMEADD".

 

Any ideas? @LordNeilLord

LordNeilLord
15 - Aurora

Hey @RogerA

 

My sincere apologies, I was typing quickly and should have checked first the formula should be:

 

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

 Neil

dlopez
8 - Asteroid

 

UPDATE: I think I figured it out

would it be something like this...? 

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

---------------------------------------------------------------------------------------------------------------------------------------------------------------

@LordNeilLord

 

what if you wanted to go back six months from the first of the month, and not today's date? 

 

Example, I want filter data on the past six months, not from today's date (07/06/2020) rather I want to filter the past six months from 07/01/2020). 

 

Any idea, how to adjust the formula for this? 

 

Cheers, 

david

Labels