In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Get X date before DateTimeNow

ll1100000
8 - Asteroid

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.

 

 

2 REPLIES 2
MarqueeCrew
20 - Arcturus
20 - Arcturus
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.

Cheers,

Mark
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
ll1100000
8 - Asteroid

@MarqueeCrew

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"

Labels
Top Solution Authors