Alteryx Designer Desktop Discussions

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

Formula

Lkschwe
7 - Meteor

How do I modify the following formula to enter 0 or blank if the DateTimeDiff([First Login],[Start Date],"days") = negative number of days?

 

Formula:

DateTimeDiff([First Login],[Start Date],"days")

4 REPLIES 4
Luke_C
17 - Castor

Hi @Lkschwe 

 

You could use an if statement:

 

IIF(DateTimeDiff([First Login],[Start Date],"days")<0,0,DateTimeDiff([First Login],[Start Date],"days"))

 

Green: Condition, is the difference < 0 

Red: Value if the condition is true (0)

Orange: values for if condition is false, the difference between the days

 

 

PhilipMannering
16 - Nebula
16 - Nebula

You can use,

max(DateTimeDiff([First Login],[Start Date],"days"), 0)
echuong1
Alteryx Alumni (Retired)

Another method is a standard conditional statement:

 

if DateTimeDiff([First Login],[Start Date],"days")<0

then 0

else DateTimeDiff([First Login],[Start Date],"days")

endif 

Qiu
20 - Arcturus
20 - Arcturus

@Lkschwe 
Looks like I am late for the party.

I made sample with all the nice formula provided and just a note that if you want "Blank", the output has to be string.

Null can be for numeric value though.

Capture1.PNG

Labels