Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

IF Statement for Date Selection via Formula Tool

CDIns
8 - Asteroid

Trying to set up an automated work flow that is pulling out data from a larger data set based on the date field. This exercise is completed in the first week of the month for the previous month. For example, In May I'll be looking for just April data. To make things even more complicated, my data set is year to date. 

 

Is there an IF Statement I can apply here, something like:

 

IF [ReportingDate]> Current Month end date minus 2 months AND <= Current Month end 

 

For May something like:

 

IF [ReportingDate]>03/31/25 and <=04/30/25  

 

I am trying to avoid having to update my data parameters each month. 

 

Any ideas? 

 

Thanks in advance, Community!

3 REPLIES 3
Deano478
12 - Quasar

@CDIns the best approach would be to first get the previous month start and previous month end and then create a dynamic filter from there 

binuacs
21 - Polaris

@CDIns 

[ReportingDate] > toDate(DateTimeTrim(DateTimeAdd(DateTimeToday(),-1,'month'),'lastofmonth'))
AND
[ReportingDate] <= toDate(DateTimeLastOfMonth())

image.png

CDIns
8 - Asteroid

Hi Binuacs, thank you for the reply. Quick follow up, since we are currently in April, how would I get it to to be <02/28/25 and <= 03/31/25? 

 

Please disregard- I was able to back into it using the formulas you provided above

 

Thanks!

Labels
Top Solution Authors