Alteryx Designer Desktop Discussions

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

Dynamic Rename of Headers that are Years

NarulaM12
6 - Meteoroid

Hi, 

 

I have data in an excel file that has two columns named 2019 and 2018. As the test will be used over a number years the the headers will change to 2020 2019 and 2021 and 2020 respectively over time. Is there a way in which I can take the header with most recent year and rename it to Current Year and the later year to prior year? 

2 REPLIES 2
TonyA
Alteryx Alumni (Retired)

There are a lot of ways to do this. One approach is a Dynamic Rename tool with the formula:

IF [_CurrentField_] = ToString(DateTimeYear(DateTimeToday()) )
THEN "Current Year"
ELSEIF [_CurrentField_] = ToString(DateTimeYear(DateTimeToday()) - 1)
THEN "Previous Year"
ELSE [_CurrentField_]
ENDIF

I've attached an example.

NarulaM12
6 - Meteoroid

Thanks Tony! Works Great!!

Labels