Alteryx Designer Desktop Discussions

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

OR condition not working in Filter tool

barb_mooney
5 - Atom

Can anyone tell me why this filter is not working and how to fix it? I used a select tool to format the Invoice Date column as DateTime and I also tried it formatted as just Date

 

The invoice date column comes in formatted like this

2019-01-31

 

DateTimeYear([Invoice Date]) = 2019
AND
DateTimeMonth([Invoice Date]) = 01
or
DateTimeYear([Invoice Date]) = 2019
AND
DateTimeMonth([Invoice Date]) = 02
or
DateTimeYear([Invoice Date]) = 2019
AND
DateTimeMonth([Invoice Date]) = 03

3 REPLIES 3
Thableaus
17 - Castor
17 - Castor

Hi @barb_mooney 

 

Here's a better version of your condition:

DateTimeYear([Invoice Date]) = 2019 AND DateTimeMonth([Invoice Date]) IN (1,2,3)

 

Or you could do this:

DateTimeYear([Invoice Date]) = 2019 AND DateTimeMonth([Invoice Date]) <= 3


Cheers,

 

barb_mooney
5 - Atom

Thanks! I used this option and it worked great

 

DateTimeYear([Invoice Date]) = 2019 AND DateTimeMonth([Invoice Date]) IN (1,2,3)

ChrisTX
15 - Aurora

Your original code would have worked if you used more parenthesis

 

(DateTimeYear([Invoice Date]) = 2019
AND
DateTimeMonth([Invoice Date]) = 1)
or

(DateTimeYear([Invoice Date]) = 2019
AND
DateTimeMonth([Invoice Date]) = 2)
or
(DateTimeYear([Invoice Date]) = 2019
AND
DateTimeMonth([Invoice Date]) = 3)

 

 

But @Thableaus code is more concise.

Labels