In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

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
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
21 - Polaris
21 - Polaris

@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
Top Solution Authors