Alteryx Designer Desktop Discussions

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

How dynamically find the latest year field name and change it's name

inguli
6 - Meteoroid

Hello,

 

I would like dynamically find the field name which has the latest years in it and change it's name as per screenshot below. What is the easiest way to achieve this?

 

Many thanks

 

Dynamically change field name.PNG

5 REPLIES 5
ChrisTX
15 - Aurora

Use a Field Info tool (Developer ribbon) to get the field names.

Sort field names.

Create a new field to hold the one new name, with a Formula tool.

Use Dynamic Rename tool.

 

If you post your data in a table or as an attachment you'll likely get example workflows.

 

Chris

Raj
16 - Nebula

@inguli 
use dynamic rename tool
if contains([_CurrentField_],right(tostring(datetimeyear(DateTimeToday())),2)) then "Amount" else [_CurrentField_] endif

workflow attached for reference
mark done if solved.

inguli
6 - Meteoroid

Sorry, I'm quite a newbie with Alteryx and Alteryx community. 

 

Many thanks @ChrisTX and @Raj for the provided solutions and for suggestion about posting data in a table or as an attachment.

 

@Raj solution nearly works but because my actual data had 2024-25 field in it, it renamed the 2024-25 field to Amount and 2023-24 field to Amount2.

Is it possible to adjust the formula so it changes the field name on the highest year?

Raj
16 - Nebula

@inguli 
three ways of achieving this has been added

mark done if solved.

inguli
6 - Meteoroid

@Raj, many thanks, this is what I was looking for.

Labels