community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

Dates Subtraction and conversion

I'm trying to subtract a column full of random dates - 12/31/2018. If the result < 366 then pick numbers from 'ST' and if > 366 then pick numbers from 'LT'. It would be great if someone can give me an idea on how to go with this.

Alteryx Certified Partner
Alteryx Certified Partner

Hi @vissamsettyvivek 

 

In which format are your dates?

 

Cheers,

Hi @Thableaus , my dates are in the following format.

Alteryx Certified Partner
Alteryx Certified Partner

@vissamsettyvivek 

 

IF your dates follow the same format as '12/31/2018' then I'd recommend this formula:

 

EDIT: Sorry, typo, change T for Y

 

typo.PNG

 

- Use DateTimeParse function to change your date format to Alteryx format

- Use DateTimeDiff function to calculate difference from dates (in your case, subtract the dates)

 

Something like this:

 

IF DateTimeDiff(DateTimeParse([Date 1], "%m/%d/%Y"), '2018-12-31', "days") < 366 THEN [ST]
ELSE [LT] ENDIF

 

Cheers,

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

@vissamsettyvivek 

 

It seems they are in this format: 31-Dec-18

 

So, this function would fit:

 

IF DateTimeDiff(DateTimeParse([Date 1], "%d-%b-%y"), '2018-12-31', "days") < 366 THEN [ST]
ELSE [LT] ENDIF

 

Cheers,

Alteryx Certified Partner
Alteryx Certified Partner

@vissamsettyvivek 

 

Also, check this help document to understand how date parsing and specifiers work:

https://help.alteryx.com/10.1/Reference/DateTimeFunctions.htm


Cheers,

Thanks @Thableaus !

Labels