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.
SOLVED

If statement with date

Kinetic_analytics
11 - Bolide

Hello:

How can I transform the following IF conditional into alteryx?

 

X2=80 days

 

 

=IF(X2<7.99,"0-7 days",IF(X2<=30,"8-30 days",IF(X2<=60,"30-60 days",IF(X2<=90,"60-90 days",IF(X2<=120,"90-120 days",IF(X2<=180,"120-180 days","over 180 days"))))))

 

Thanks

5 REPLIES 5
Luke_C
17 - Castor
17 - Castor

Hi @Kinetic_analytics 

 

See below example. For future reference, in the formula tool if you type 'IF' it will give you the syntax that Alteryx needs:

 

Luke_C_1-1640268976357.png

 

If [Field1] < 7.99 then '0-7 days'
elseif [Field1] <= 30 then '8-30 days'
elseif [Field1] <= 60 then '30-60 days'
elseif [Field1] <= 90 then '60-90 days'
elseif [Field1] <= 120 then '90-120 days'
elseif [Field1] <= 180 then '120-180 days'
else 'over 180 days'
endif

Luke_C_0-1640268922008.png

 

 

binuacs
21 - Polaris

@Kinetic_analytics your  formula is correct, just change IF to IIF

 

IIF([X2]<7.99,"0-7 days",IIF([X2]<=30,"8-30 days",IIF([X2]<=60,"30-60 days",IIF([X2]<=90,"60-90 days",IIF([X2]<=120,"90-120 days",IIF([X2]<=180,"120-180 days","over 180 days"))))))

 

binuacs_0-1640269350664.png

 

Kinetic_analytics
11 - Bolide

I am getting Invalid type of operator 😞

 

Kinetic_analytics_0-1640273833753.png

 

Luke_C
17 - Castor
17 - Castor

Hi @Kinetic_analytics 

 

Please provide sample data. Make sure the field with the number is saved as a numeric data type.

Kinetic_analytics
11 - Bolide

Thanks. It works. 🙂 

Labels
Top Solution Authors