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:
Name | Cost | Month |
ABC Ltd | 100 | July,2019 |
XYZ Ltd | 500 | July,2019 |
Expected Output:
Name | Cost(July,2019) | Month |
ABC Ltd | 100 | July,2019 |
XYZ Ltd | 500 | July,2019 |
Thanks
Solved! Go to Solution.
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.
Attaching the quick sample
Thanks @NickSm
And if we want to do the same thing for multiple columns, would the same logic be applicable?
Regards
Taher
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.
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
@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.
@NickSm
It would be the same month. Existing file would be like this:
Sample
Name | Cost | Count | Value | Month |
ABC Ltd | 100 | 5 | 60 | July,2019 |
XYZ Ltd | 500 | 3 | 350 | July,2019 |
Expected Output
Name | Cost(July,2019) | Count(July,2019) | Value(July,2019) | Month |
ABC Ltd | 100 | 5 | 60 | July,2019 |
XYZ Ltd | 500 | 3 | 350 | July,2019 |
Also, the month column would not change, so it will just have one value across the entire data set.
@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.
@NickSm Thanks a lot. Used the same logic in my workflow and it worked perfect. 🙂