Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Date Filter Expression

pvara
8 - Asteroid

I have a dataset that has historical data.

How can I modify this expression to include the previous calendar year?

 

[CREATEDATE] >= ToDate(DateTimeAdd(DateTimeToday(), -1, "year"))

 

The desired result would include CREATEDATE that has values From

2019-01-01 Thru 2020-11-04

 

Thank you

4 REPLIES 4
MarqueeCrew
20 - Arcturus
20 - Arcturus

How about:

 

[CREATEDATE] >= Left(DateTimeAdd(DateTimeStart(), -1, "year"),10)

 

 cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.

Hi @pvara 

 

Is this what you are looking for?

 

[CREATEDATE] >= datetimeformat(ToDate(DateTimeAdd(DateTimeToday(),-1, "year")),"%Y-01-01")

 

Cheers!

pvara
8 - Asteroid

Thank you christine your expression was spot on.. 

Maskell_Rascal
13 - Pulsar

Hi @pvara 

 

This formula would also work for you. 

[CREATEDATE] >= Left(DateTimeAdd(DateTimeToday(), -1, "year"),4)

 

Thanks!

Phil

Labels
Top Solution Authors