Alteryx Designer Desktop Discussions

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

Help with If statement

davidogundipe
8 - Asteroid

Hi guys, 

 

I've been trying to get this if statement to work in the formula tool. Please let me know what I'm doing wrong. Alteryx keeps saying "malformed if".

 

IF [Date] >= 01/01/2020 and [Date] < 04/01/2020 THEN "Quarter 1"

ELSEIF

[Date] >= 04/01/2020 and [Date] < 07/01/2020 Then "Quarter 2"

ELSEIF

[Date] >= 07/01/2020 and [Date] < 10/01/2020 Then "Quarter 3"

ELSE

"Quarter 4"

END IF

5 REPLIES 5
vizAlter
12 - Quasar

Hi @davidogundipe — Two things to fix in your formula express:

1) Put the dates in " " (quotes or double quotes) and hope your [Date] field is in proper DATE datatype

2) remove space between "END IF" so write it like "ENDIF"

davidogundipe
8 - Asteroid

Thank you!

vizAlter
12 - Quasar
IF [Date] >= "01/01/2020" and [Date] < "04/01/2020" THEN 
	"Quarter 1"
ELSEIF [Date] >= "04/01/2020" and [Date] < "07/01/2020" Then 
	"Quarter 2"
ELSEIF [Date] >= "07/01/2020" and [Date] < "10/01/2020" Then 
	"Quarter 3"
ELSE
	"Quarter 4"
ENDIF

vizAlter_0-1605844579935.png

 

vizAlter
12 - Quasar

@davidogundipe — Thank you!

Qiu
20 - Arcturus
20 - Arcturus

@davidogundipe 
Just to add to @vizAlter  comments, the date as criteria has to be Alteryx Standard Format yyyy-mm-dd.

 

1120-davidogundipe.PNG

Labels