Start Free Trial

Alteryx Designer Desktop Discussions

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

Date range two years ago

J054305
6 - Meteoroid

I have a where clause 

CreatedDate = THIS_YEAR or CreatedDate = LAST_YEAR

 

Is there a simple way of adding two years prior? I.e. “or” Two_years_prior? I need to pull current and two years prior

 

thank you in advance !

4 REPLIES 4
JagdeeshN
12 - Quasar
12 - Quasar

Hi @J054305 ,

 

You can create this range with the following formula:-

 

[This_Year]=ToNumber(DateTimeFormat(DateTimeToday(),"%Y"))

[Last_Year]=ToNumber(DateTimeFormat(datetimeadd(DateTimeToday(),-1,'year'),"%Y"))

 

Hope this helps.

 

Best,

Jagdeesh

J054305
6 - Meteoroid

Thank you, I need a formula to pull year 2020. 
I currently have current and last year. Is there a simple “Last_2_years” where clause for alteryx?

Aguisande
15 - Aurora
15 - Aurora

Last_Year - 1

IN Clause

<=  and >=

JagdeeshN
12 - Quasar
12 - Quasar

@J054305  you can the This -2 Year with this formula:-

 

[Last_Year]=ToNumber(DateTimeFormat(datetimeadd(DateTimeToday(),-2,'year'),"%Y"))

 

 

You can then use this in your where clause using the dynamic input tool.

Labels
Top Solution Authors