Free Trial

Alteryx Designer Desktop Discussions

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

Filter current year and previous year

Ultralightbeam
8 - Asteroid
DateTimeFormat([DoB],"%Y") = 
DateTimeFormat(DateTimeNow(),"%Y") or DateTimeFormat([DoB],"%Y") = 
(tonumber(DateTimeFormat(DateTimeToday(),"%Y"))-1)

 

Hey guys I am trying to filter the DoB column based on current year and last year. I am getting an error invalid type in  operator ==

2 REPLIES 2
clmc9601
13 - Pulsar
13 - Pulsar

@Ultralightbeam, this error has to do with data types. If you had to convert the result of DateTimeFormat to number in order to subtract 1, that probably means they're all stored as strings (if you did this based on a guess, then my conclusion isn't as solid). If this is the case, then right now you're evaluating:

string = string OR string = number

So the second expression (bold) would be your problem. I'd try converting your number back to a string. If this doesn't work, then it's probably some other combination of string/number mismatch.

Qiu
21 - Polaris
21 - Polaris

@Ultralightbeam 

Just as @clmc9601 pointed out, we need to change it back to string after the numeric calculation for the latter creteria.

0121-Ultralightbeam.PNG

 

Labels
Top Solution Authors