Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Extract data by current month

I have a database used in several different processes. In one of these processes I must extract data from the current month every month. The database has been accumulating data for 4 years. How do I specifically extract the current month's data from so much data every month?

5 REPLIES 5
DataNath
17 - Castor
17 - Castor

Do you have a date field in your data? If so, you can just filter on this so that:

DateTimeMonth([DateField] = DateTimeMonth(DateTimeNow())

AND

DateTimeYear([DateField] = DateTimeYear(DateTimeNow())

 

If you're doing this In-DB, it'd look something like:

 

WHERE MONTH(datefield) = MONTH(GETDATE()) AND YEAR(datefield) = YEAR(GETDATE())

 

Or can try using NOW() instead of GETDATE()

 

Depending on the SQL syntax of the db you're using.

Hello.

Yes, I have a Date Field, but I tested your formula and it gave an error message:
Error: Formula (4): Parsing error in char(130): Malformed function call (Expression #1)

 

I'm sorry for the prints in Portuguese, but I translated the message here in the answer

DataNath
17 - Castor
17 - Castor

Hey @Arthur_Gonçalves, it looks like you're missing a closing bracket ) after the last square bracket of your date field before the = in both the month and year. Was also thinking you would use this in a Filter tool as well, rather than a Formula, but that depends on your use case obviously!

Oh sorry 😅

Now it worked, I added the ) and used the formula in a filter.

Thank you very much!

DataNath
17 - Castor
17 - Castor

No problem at all, glad we could get it sorted! :)

Labels
Top Solution Authors