Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

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

IF Statement

Kristie_Pires
8 - Asteroid

Hello there,

 

I need help writing an IF statement or whatever formula to get what I need. I have the first piece which is (if the "Last Change Dt" happened between "From" and "To" then the column "Change or No Change" is populated with "Change".

 

IF [Last Change Dt] > [From ] and [Last Change Dt] < [To] then "Change" else "No Change" endif

 

However, I was asked to say "No Change" whenever the "Last Change Dt" happened any date greater than 2 months ago (it has to be dynamic as I use it every month).

Any ideas would help :) 

FromToLast Change DtChange or No Change
06/27/202207/28/202201/01/2019No Change
06/13/202207/12/202201/01/2016No Change
06/01/202207/01/202201/01/2016No Change
06/08/202207/10/202207/05/2022Change
06/04/202207/04/202207/05/2022No Change
05/25/202206/25/202206/18/2019No Change
06/02/202207/02/202206/03/2015No Change
06/10/202207/10/202206/21/2021No Change
5 REPLIES 5
flying008
14 - Magnetar

Hi, @Kristie_Pires 

 

Try this formula:

 

 

IF DateTimeDiff(DateTimeAdd(DateTimeNow(),-2,"months"),DateTimeParse([Last Change Dt],"%m/%d/%Y"),"day") >1 THEN "No Change" 
ELSEIF [Last Change Dt] > [From] and [Last Change Dt] < [To] 
then "Change" 
else "No Change" endif

 

Qiu
21 - Polaris
21 - Polaris

@Kristie_Pires 
similar with the approach @flying008 , but added the DateTime Conversion part.

0831-Kristie_Pires.PNG

binuacs
20 - Arcturus

@Kristie_Pires Another way of doing this with the Multi-Field formula

binuacs_0-1661937373835.png

 

Kristie_Pires
8 - Asteroid

Thank you so much all of you for the different solutions! They all work for what I needed 😊

Qiu
21 - Polaris
21 - Polaris

@binuacs 
Nice one on using Multi-column function for the DateTime Conversion part. 😁

Labels