We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Finding previous month of data using IN-Database functions

lasmithfla
6 - Meteoroid

How do I write something similar to this to use in database?

Trying to pull the previous month of data and automate it.

 

DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,"month"),'%Y-%m') = DateTimeFormat([EventDate],'%Y-%m')

1 REPLY 1
apathetichell
20 - Arcturus

kind of depends upon the back end of the SQL but something like:

TRUNC(DATEADD(MONTH, -1, GETDATE()), "YY-DD") = TRUNC("EventDate", "YY-DD")

 

 

Labels
Top Solution Authors