Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

If and statement

stein
5 - Atom

I am trying to replace all the values in the Savings_Rate field with 0 if the year is >2022 and the type of rate is "Savings_Rate_ABC". I have tried a versions of the below code and I am getting Null values for all years with the Savings_Rate_ABC. Any suggestions?

 

If ([Savings_Rate_Type]="Savings_Rate_ABC" AND ([Year]>=2022)
)
then 0
else [Savings_Rate]
endif

3 REPLIES 3
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @stein,

 

Your formula looks to be working, what data type are you storing the year as?

 

JonathanSherman_0-1645126450430.png

 

Kind regards,

Jonathan

 

Qiu
21 - Polaris
21 - Polaris

@stein 

Maybe we should as check the field type for " Savings_Rate". 

It will be error if it is not numeric field, and try below see it works or not.

 

If ([Savings_Rate_Type]="Savings_Rate_ABC" AND ([Year]>=2022)
)
then '0'
else [Savings_Rate]
endif


 

amruthas2
8 - Asteroid

Hi @stein 

Your formula seems to be correct, do check on the data type for the fields 

IF [Savings_Rate_Type]="Savings_Rate_ABC" AND [Year]>=2022
THEN 0
ELSE [Saving_Rate]
ENDIF

amruthas2_0-1645157726787.png

amruthas2_1-1645157747786.png

 

 

Labels
Top Solution Authors