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 Formula Error

IvanMtz88
6 - Meteoroid

Hello Community i hope you're having a good day 

 

I have a problem i need to validate some dates in a formula but when i run the workflow it only takes the last formula and pout the output that is incorrect could you please tell me what im doing wrong 

 

IvanMtz88_0-1677506956832.png

 

When i run the workflow when the date is in 202353 is putting -199 instead of 1

 

Thank you for all your help in advance

 

1 REPLY 1
FinnCharlton
13 - Pulsar

Hi @IvanMtz88 ,  you will want to change how you are configuring this tool.

 

At the moment, each formula is being applied in sequence. Therefore the last formula is being applied last, and overrides every change made before that. For example, a date of 202353 will have the value of 202552 subtracted from it, giving you the -199.

 

Instead, try using an 'elseif' statement. Something like this:

IF [startweek]>=202353 and [startweek]<=202400
then
[startweek]-202352
elseif
[startweek]>=202453 and [startweek]<=202500
then
[startweek]-202452
elseif
[startweek]>=202553 and [startweek]<=203600
then
[startweek]-202552
else 0
endif
Labels
Top Solution Authors