Alteryx Designer Desktop Discussions

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

Complex IF/AND statement with a date range

Amehok
6 - Meteoroid

Hi everyone!

 

I am really stuck on how to perform a complex IF statement that involves a date range and was wondering if anyone could help. I have tried both ways (below) but I receive "formula warnings" with each way and both produce null values in my data output. I am trying to make the workflow so that if a date is in a certain range, then it performs a specific calculation. Any ideas on how to achieve this?

 

IF [Cost x Rate]=0 AND [Depreciation Method]="STL" AND ([Date Placed In Service]>=2017-07-30 AND [Date Placed In Service]<=2017-08-26) THEN ([Cost]/36)*12 Elseif
[Cost x Rate]=0 AND [Depreciation Method]="STL" AND [Date Placed In Service] IN(2017-08-27,2017-09-30) THEN ([Cost]/36)*11 Elseif.....

 

 

Thanks in advance!

2 REPLIES 2
jasperlch
12 - Quasar

Hi @Amehok,

 

A pair of quotes is needed for date values.

 

For example: 

[Date Placed In Service]>='2017-07-30'

 

if you would like to check if the date field is within 2017-08-27 and 2017-09-30: 

[Date Placed In Service] >= '2017-08-27' and [Date Placed In Service] <= '2017-09-30'

 

if you would like to check if the date field is equal to 2017-08-27 or 2017-09-30: 

[Date Placed In Service] in ( '2017-08-27', '2017-09-30')

 

 

Amehok
6 - Meteoroid

Thank you so much for your help! This worked wonderfully!

Labels