Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

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

Renaming columns with Date

CM246
6 - Meteoroid

Hi I have a work flow where Month 1 is current Month, Month two is current Month + 1 and so on up until 30 months from now. 

 

How do I rename these columns that Month 1 is July 2024, Month 2 is August 2024 and so on... but this is changing each month so next month when I run the report I would need month 1 to be August 2024, Month 2 to be September 2024 etc... 

 

 

5 REPLIES 5
Qiu
21 - Polaris
21 - Polaris

@CM246 
I assume your current field Name willbe Month+ Digit, the then seperate the number out then together with DdateTime Fuction, we can transform it to the format you need.
note we need also the "Month Year" in numeric format so the order of fields is correct.

 

0726-CM246.png

DataNath
17 - Castor

Hey @CM246, if your field names are actually currently 'Month 1', 'Month 2' and so on then this is what I've come up with. This parses out the number in 'Month N', adds that amount of months -1 to the current date and then formats this as 'Month Year' i.e. January 2020:

 

fed.png

 

DateTimeFormat(
DateTimeAdd(
DateTimeToday(),
ToNumber(
Regex_Replace([_CurrentField_],'\D','')
)-1,
'month')
,'%B %Y')
cjaneczko
13 - Pulsar

Another way using the field info tool. 

 

 

 

if [Name] = 'Month 1' then datetimeformat(datetimenow(),'%B %Y') elseif startswith([Name],'Month') then datetimeformat(datetimeadd(datetimeparse([Row-1:Date],'%B %Y'),1,'month'),'%B %Y') else [Name] endif

 

 

 

image.png

image.pngimage.png

CM246
6 - Meteoroid

Is there a way to replace anywhere it says Month 1, Month 2 etc?

 

The Fields aren't just Month 1, Month 2 but are:

Month 1 Open PO

Month 1 Finance Projection

Month 1 Planned Orders etc... 

aatalai
14 - Magnetar

@CM246 I would suggest an update of @DataNath 's solution using a dynamic rename use this

 

DateTimeFormat(
DateTimeAdd(
DateTimeToday(),
ToNumber(
Regex_Replace([_CurrentField_],'\D','')
)-1,
'month')
,'%B %Y') + Regex_Replace([_CurrentField_],'Month\s\d+','')

Labels