Free Trial

Alteryx Designer Desktop Discussions

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

If with dates

BautistaC888
8 - Asteroid

Hello,

I'm trying to run the following conditional expression with dates but this error occurs.

BautistaCaparelli_0-1615319381863.png

BautistaCaparelli_1-1615319411543.png

 



Thank you.

6 REPLIES 6
Emil_Kos
17 - Castor
17 - Castor

Hi @BautistaC888,

 

Can you try removing '[Stard date] ='

I think you don't need it. 

AngelosPachis
16 - Nebula

Hi @BautistaC888 ,

 

What's the data type of the field [Start_Date]? Is it a string?

 

Dates in Alteryx should have a specific format of yyyy-mm-dd.

 

If you also want to apply operators on dates, you should first convert your Start_Date field into a Date data type (you can do that with a DateTime tool).

 

Then your formula tool should slightly change to accommodate the changes in the DateFormat. You should use something in the lines of

 

 

IF [Start_Date_Converted]<="2021-01-31" THEN "2021-01-31" ELSE [Start_Date_Converted]
ENDIF

 

 

where [Start_Date_Converted] is your Start Date in a format that alteryx can understand as a date.

 

I have attached a workflow as an example.

 

Hope that helps,

 

Angelos

BautistaC888
8 - Asteroid

BautistaCaparelli_0-1615319968085.png

 

BautistaCaparelli_1-1615320031782.png

Hi Emil,
Still happened

AngelosPachis
16 - Nebula

@BautistaC888 

 

You should also add your fields in quotation marks, so your expression should be

 

 

IF [Start_Date]<="31/1/2021" ...

 

 

but still this won't give you what you are looking for as Alteryx is treating "31/1/2021" as a string and cannot understand what you mean by typing <=, unless you first convert it to a date data type (see my previous post for more details)

gabrielvilella
14 - Magnetar

Hi @BautistaC888 

 

First, you can only compare dates that are written in date format (YYYY-MM-DD). So your condition should be [Start_Date] <= '2021-01-31'. 

 

Second, you don't need to call the field name again to insert the true result. You just need to make sure you have selected the field in the Output Column.

 

gabrielvilella_0-1615320295667.png

 

Emil_Kos
17 - Castor
17 - Castor

Hi @BautistaC888,

 

If you will add quotation for dates like @AngelosPachis said it will work. 

Labels
Top Solution Authors