Alteryx Designer Desktop Discussions

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

Dynamic Input to Populate Column Name

tahertalib
7 - Meteor

Hi,
Could you please let me know how to populate a column name based on the date from another field?

 

I am inputting Data for 2 months from separate sheets and each has a column giving the Month. I am then joining both these sheets to compare any difference from Current Month to Previous Month for a specific field.

 

How can i dynamically change/Append the Cost field to be "Cost(July,2019)" and "July,2019 would be from a different column so that every time i upload a new sheet, the corresponding month gets populated?

 

Sample:

 

NameCostMonth
ABC Ltd100July,2019
XYZ Ltd500July,2019

 

Expected Output:

 

NameCost(July,2019)Month
ABC Ltd100July,2019
XYZ Ltd500July,2019

 

Thanks

8 REPLIES 8
NickSm
Alteryx
Alteryx

Hey @tahertalib,

 

Can do this with a dynamic rename tool, which should make it flexible as things change.  Had to get the desired new header and the field to replace to feed into the "R" input of the rename.

 

clipboard_image_0.png

 

Attaching the quick sample

tahertalib
7 - Meteor

Thanks @NickSm

And if we want to do the same thing for multiple columns, would the same logic be applicable?

 

Regards

Taher

NickSm
Alteryx
Alteryx

@tahertalib 


Yep, should be able to apply the same logic.  You'll just want one record for each header you want to change, with the respective "OldHeader" and "NewHeader".  Should be pretty easy by just adding a GroupBy in the Summarize tool, and make the Formula tool an If statement to fill the NewHeader column.

tahertalib
7 - Meteor

@NickSm 

 

The formula tool in the Rename doesn't work if i have a Right Input.
Would it be possible for you to give a sample with multiple rows in the old workflow you shared? 

 

That will help me figure out which where am i going wrong.

 

Regards

Taher

NickSm
Alteryx
Alteryx

@tahertalib , would you be looking to add the same (month, year) tag to each header, or would it vary?

If you're able to give an example of the before and after as you did in your first post that would be helpful for giving the best solution.

tahertalib
7 - Meteor

@NickSm 

It would be the same month. Existing file would be like this:

 

Sample

 

NameCostCountValueMonth
ABC Ltd100560July,2019
XYZ Ltd5003350July,2019

 

Expected Output

 

NameCost(July,2019)Count(July,2019)Value(July,2019)Month
ABC Ltd100560July,2019
XYZ Ltd5003350July,2019

 

Also, the month column would not change, so it will just have one value across the entire data set.

NickSm
Alteryx
Alteryx

@tahertalib  - Here's a workflow based off the one before, just done a little bit more dynamically by pivoting the current headers down and using those to rename.

 

 

tahertalib
7 - Meteor

@NickSm Thanks a lot. Used the same logic in my workflow and it worked perfect. 🙂 

Labels