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

How to filter months (as string two digit) to forward looking months ?

c_raviram
7 - Meteor

Hello expert, I have a field month as string with below values. I want to build a dynamic filter which will only select month greater than equal to current month. (Eg. If I run today, the filter should select month as >=5).

I have build below formula, which works fine,  if month are in single digit and does not work if two digits (like below case). I cannot change the month type to measure. 

 

[Month] > ToString(DateTimeMonth(DateTimeNow())-1)

 

01
02
03
04
05
06
07
08
09
10
11
12

 

2 REPLIES 2
apathetichell
20 - Arcturus

your problem is that 01 is a string - not an integer to so you need to adjust:

 

tonumber([month]) > tonumber(datetimemonth(dattimenow()))-1

 

 

ENix
8 - Asteroid

If your Month field has to be a String you can force the data type to a number for the calculation - ToNumber([Month]) > DateTimeMonth(DateTimeNow())-1

Labels
Top Solution Authors