Free Trial

Alteryx Designer Desktop Discussions

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

Filtering previous year data based on the current year.

Alteryxexpert
8 - Asteroid

I have developed an workflow in 2024 in which I have the below condition,


Right([Month], 2)= Right(tostring(DateTimeYear(DateTimeToday())), 2) to filter out the same year data, I will always have data one month late for reporting, that is, I will report Jan 24 month data on feb 24, feb 24 on march 24 like this and now dec 24 data now on jan 25. for this the above condition is not working as it filters the current year data.

 

Is there a way to make this work dynamically so that the correct data will be picked every month even if there is a year change. Kindly Help.

5 REPLIES 5
binuacs
21 - Polaris

@Alteryxexpert I assume your month field is in the format of mm/dd/yyyy, try the below condition in the filter tool

DateTimeYear(DateTimeParse([Month], "%m/%d/%Y")) = 
  DateTimeYear(DateTimeAdd(DateTimeToday(), -1, "months")) AND
DateTimeMonth(DateTimeParse([Month], "%m/%d/%Y")) = 
  DateTimeMonth(DateTimeAdd(DateTimeToday(), -1, "months"))

 

Alteryxexpert
8 - Asteroid

@binuacs month filed is MMM-YY that is Jan-24,Feb-24,Mar-24..

binuacs
21 - Polaris

@Alteryxexpert 

DateTimeYear(DateTimeParse([Month], "%b-%y")) = 
  DateTimeYear(DateTimeAdd(DateTimeToday(), -1, "months")) AND
DateTimeMonth(DateTimeParse([Month], "%b-%y")) = 
  DateTimeMonth(DateTimeAdd(DateTimeToday(), -1, "months"))
Alteryxexpert
8 - Asteroid

@binuacs This is just filtering the DEC -24 data alone but data from Jan 24 to Dec 24 needs to be filtered in Jan - 25 and in Feb -25 data from Jan 24 - Jan 25 needs to be filtered and it so on. 

To be more precise : From Feb-Dec the logic should filter the current year data and on Jan it should filter the Previous year data.

binuacs
21 - Polaris

@Alteryxexpert can you try the attached workflow logic

 

Labels
Top Solution Authors