Alteryx designer Discussions

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

Get X date before DateTimeNow


I have been trying many SQL expression to get this work, but no luck when "NOT IN DB"

I want to get the [date]<= DateTimeNow() - X

so I can change the x to any of the date that I need.

Example, X=1, which means Today() - 1


Date = DatetimeNow works, but when subtracting a number, it doesn't work.


Thank you.



Alteryx Certified Partner
Alteryx Certified Partner
Do you really want 01 to be February?

Did you know that you can use a date field to get to the month name quickly?

DateTimeFormat([Date],"%b") will return just the month name abbreviation.

For your switch, is month a string or number?

You seem to be hitting the default value. Check your data to make sure that there are no spaces or missing leading zeros.


Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.


WOW you are so fast to catch my question!  But I figured out the problem 2 minutes after, so I changed the content..... Very sorry, I don't know how to delete the topic.


Yes, I really meant 01 to be February.

I should remove the "0" in front of each number...

"1", "FEB"


Then it works!!!

Thank you very much for letting me know this function!

"DateTimeFormat([Date],"%b") will return just the month name abbreviation"