Alteryx Designer Desktop Discussions

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

Having trouble with IF function for Dates - Please help!

CDIns
8 - Asteroid

Hello, 

 

I have to apply a 'group' to my list of aging receivables. They fall into a few buckets - due in less than a year, due in 5 years, etc. 

 

My data set has due dates in following format MM/DD/YYYY, however, after I input the data it changes the format to YYYY/MM/DD and recognizes the data type as Date. No big deal. 

 

My formula is as follows: 

 

IF [Maturity]< "2024-12-31" THEN "Due in 1 year or less"
ELSEIF [Maturity]> "2024-12-31" AND [Maturity]<"2028-12-31" THEN "Due after 1 year through 5 years" ELSEIF [Maturity]>"2028-12-31" AND [Maturity]<"2033-12-31" THEN "Due after 5 years through 10 years" ELSEIF [Maturity]>"2033-12-31" THEN "Due after 10 years" ELSE [Maturity] ENDIF

 

After I run the workflow, my maturity column is coming back [Null] for all records, despite having a date for reach record and the last part of my IF function says to just leave the data as is if it doesn't meet any of the conditions in my formula. 

 

Can somebody please help me understand why this isn't working? 

 

thank you, 

 

 

3 REPLIES 3
danilang
19 - Altair
19 - Altair

Hi @CDIns 

 

If your formula is trying to modify [Maturity] then you're trying to force a string into a date field resulting in the nulls.  Create a new field string to hold the results of the formula

 

Dan

 

aatalai
14 - Magnetar

try putting the dates in the formula todate

 

 

e.g IF [Maturity]< todate("2024-12-31") then....

 

CDIns
8 - Asteroid

This worked - Thank you! 

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels