Alteryx Designer Desktop Discussions

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

Return 1 if Created Date is Less than Login Date else 0

MyriamB
7 - Meteor

Hello

 

I am struggling to add a Formula to return 1 if Created date is prior to Log date, other wise 0

 

I have tried

 

IF [LoginTime]<[CreatedDate]THEN'1' ELSE'0' ENDIF

but system does not like it

 

Has anyone got some sample or example of similar approach?

thank you

 

Myriam

2 REPLIES 2
MarqueeCrew
20 - Arcturus
20 - Arcturus

@MyriamB,

 

How about:

IIF([Created Date] < [Log Date],1,0)

make the data type BYTE.

 

If you define the data type as V_Wstring or any string, you'll run into errors.  That's because 0 & 1 are numbers.  If you want "0" or "1" as strings, then quotes are needed.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
BPurcell2
9 - Comet

I imagine the fields are not properly formatted as "dates."  Check the meta data in your results window to verify.

 

Use the DateTime tool under "Parse"  Alteryx has included a great help file if you click on the tool, then click open examples.  In this case you'll want to use the "String to Date/Time Format"

 

Then you'll add a formula tool with the expression:

iif([Created Date]<[Log Date],1,0) 

Labels