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

Get Current and Prior Year Dates from Data

MLRM
6 - Meteoroid

I am trying to use the Data that I have currently and transform the Fiscal End Date Column into two additional columns where one has the current Year of 2017 and another column that has the prior year of 2016. For example I need Dates for Row 1 to look like 2017-04-30 and 2016-04-30. Is there a simple way / formula to get these new years added to the dates. The Month and Days of the date are good I just want to change the year. Thanks so much. 

 

 2017-05-10_10-10-19.jpg

4 REPLIES 4
Joe_Mako
12 - Quasar

Would these formula expressions be what you are looking for, they are relative to the current system clock date:

 

Current:

DateTimeAdd([Fiscal End Date(1162)],
ToNumber(DateTimeFormat(DateTimeToday(),"%Y"))-
ToNumber(DateTimeFormat([Fiscal End Date(1162)],"%Y"))
,"year")

 

Prior:

DateTimeAdd([Fiscal End Date(1162)],
ToNumber(DateTimeFormat(DateTimeToday(),"%Y"))-
ToNumber(DateTimeFormat([Fiscal End Date(1162)],"%Y"))

-1
,"year")

MLRM
6 - Meteoroid

Yeah that works perfect. I just had to change the Formulas to DateTimeAdd but other than that it works great. So to double check these formulas are now dynamic in that when it becomes 2018 the current year and Prior Year will also change accordingly then. Thanks so much for the help. 

Joe_Mako
12 - Quasar

Yes it is relative to the current date, so on Jan 1st 2018, the current year for all will be 2018. Thanks for the note on the wrong formula, I fixed my typo :)

JessicaS
Alteryx Alumni (Retired)

Hello,

 

This post has been moved to 'Data Preparation and Blending' for greater visibility.

 

Thanks!

Jess Silveri
Manager, Technical Account Management | Alteryx
Labels
Top Solution Authors