Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
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