We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

why is my formula returning -1

wonka1234
10 - Fireball

Column = If [Date1] > [Date2] then "FAIL"
Or [Date1] = "N/A"
else Null() ENDIF

 

 

the logic should be 

 

If date1 is greater then date 2, mark Column as Fail , otherwise Null

OR if Date1 has a "N/A" in it, mark column as Null.

 

Whats wrong here?

6 REPLIES 6
gautiergodard
13 - Pulsar

Hey @wonka1234 

Try something like this:

 

If [Date1] > [Date2] then "FAIL"
elseif contains([Date1],"N/A") then null()
else Null() ENDIF

Felipe_Ribeir0
16 - Nebula

Hi @wonka1234 

 

Try 

If [Date1] > [Date2] and [Date1] != "N/A" then "FAIL"
else Null() ENDIF

 

Felipe_Ribeir0_0-1673038348600.png

 

 

AbhilashR
15 - Aurora
15 - Aurora

The syntax would go something like this:

IF [Date1]>[Date2]
	THEN 'Fail'
ELSEIF [Date1] = 'N/A'
	THEN Null()
ELSE Null()
ENDIF
wonka1234
10 - Fireball

very odd, none of these solutions are working. When Date1 = N/A I am still getting fail in my column.

davidskaife
14 - Magnetar

Hi @wonka1234 

 

Try switching it round and see if that works:

 

 

IF [Date1] = 'N/A'
THEN NULL()
ELSEIF [Date1]>[Date2]
THEN 'Fail'
ELSE NULL()
ENDIF

 

 

DavidSkaife_0-1673039194995.png

 

AbhilashR
15 - Aurora
15 - Aurora

@wonka1234 - are you able to share a few sample datapoints from your set to help us better troubleshoot?

Labels
Top Solution Authors