Alteryx Designer Desktop Discussions

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

Get First Day of the year for two years ago, relative to today

alphabex18
8 - Asteroid

I have this below formula, and I have a locked in date of "2018-01-31" that would need to change once we started the 2021 year to 2019-01-31, because I always want to show the last two calendar years worth of data. How do i replace that date with something dynamic like i do with my LastofMonth criteria?

 

[MemberTermDate]>='2018-01-31' AND [MemberTermDate] <= ToDate(DateTimeAdd(DateTimeLastOfMonth(),0,"months"))

2 REPLIES 2
AbhilashR
15 - Aurora
15 - Aurora

Hi @alphabex18, you could compute first day of the year for two years ago relative to today using a formula like this:

TODATE(
(TOSTRING(TONUMBER(DateTimeFormat(DateTimeToday(),'%Y'))-2)
+'-01-01')
)

You could use this logic within your formula. I have attached a sample for your reference. Hope this helps. 

alphabex18
8 - Asteroid

IT WORKS!!! Awesome. Thank you so much

Labels