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.

Filter for first of the last month dynamically

Ronal_bal
8 - Asteroid

Hi, 

Need to pull the date from >= first of the last month.

Below you can see an example,

Date> (DateTimeAdd(DateTimeAdd(DateTimeToday(),-1,"month"), 1-DateTimeDay(DateTimeAdd(DateTimeToday(),-1,"month")), "days"))

I tried with above formula its showing zero after the filter.


Ronal_bal_0-1658502300789.png

 

3 REPLIES 3
Nick-C
Alteryx
Alteryx

Hey @Ronal_bal ,

I've taken a slightly different approach and found the max date in your list and used that (hopefully I understood the requirement)

 

See my attached workflow to see if that works for you, what it's doing is:

- Finding the max date in the data

- Extracting the Month and Year

- Appending back to the main data

- Using those new fields to make sure our Year & Month are the same or greater than the max date

- Checking the day of our date is at least "1"

 

 

If this helps - please don't forget to accept it as a solution! 

 

DavidP
17 - Castor
17 - Castor

Hi @Ronal_bal 

 

I think a formula like this in a filter tool would achieve what you want:

 

[Date] >= todate(DatetimeAdd(DateTimeFirstOfMonth(),-1,'months'))

binuacs
21 - Polaris

@Ronal_bal one way of doing this

binuacs_0-1658558628395.png

 

Labels
Top Solution Authors