Free Trial

Alteryx Designer Desktop Discussions

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

Filter only current month data

Saravanan13
8 - Asteroid

Hello team,

 

I am looking to filter current month data from a data set. The data set will always have data till previous. (current date - 1day). I need to report data till yesterday.

 

I used  DateTimeFormat([Status Start Date], "%Y-%m") = DateTimeFormat(DateTimeToday(), "%Y-%m") as a filter, Its working fine but its not working during start of the month, Since the month does not match I am getting blank values.

 

Can anyone assist on this.

 

Sample data

 

Stage start dateABC
10/26/2023686
10/27/2023686
10/28/2023686
10/29/2023686
11/26/20231186
11/27/2023482
11/28/2023686
11/29/2023586
8 REPLIES 8
Qiu
21 - Polaris
21 - Polaris

@Saravanan13 
Say today is 2023-12-01, then your date will be upto "2023-11-30", since you want to filter the current Month "December" so there is no surprise you will get nothing.
What do you expect the result for today "2023-12-01"?

Hammad_Rashid
11 - Bolide

Check if this works:

 

[Stage start date] >= DateTimeAdd(DateTimeFirstOfMonth(DateTimeToday()), -1) AND [Stage start date] <= DateTimeAdd(DateTimeToday(), -1)

Saravanan13
8 - Asteroid

On 1st December I should get November month data and starting from 2nd December I should get December data.

caltang
17 - Castor
17 - Castor

I would caution against DateTimeNow() if you want it to be flexible. Rather, I would advise to use an Analytic app where you can select the dates to give you ultimate flexibility. 

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Saravanan13
8 - Asteroid

I am have not used Analytic app, do you have any sample workflow

Saravanan13
8 - Asteroid

There is some issue with the syntax, can you provide the formula along with the workflow.

Saravanan13
8 - Asteroid

On 1st December I should get November month data and starting from 2nd December I should get December data.

 
CoG
14 - Magnetar

If the 1st of each month should always return the prior month, you can use an adjust formula:

DateTimeFormat([Status Start Date], "%Y-%m") = DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,"day"), "%Y-%m")

This would push back dates considered by one day, thus giving you the desired result.

Labels
Top Solution Authors