Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

How to add columns containing "x" in field name

george_kwong
5 - Atom

Is there a way to create a field that adds columns with with a target string in the field name?  For the example below, add columns with "Sales_" in the header?   Currently, I use a formula tool with the expression, [Sales_Jan]+[Sales_Feb]+[Sales_Mar], but this gets cumbersome as more months' sales gets added into the data.  Thanks.

 

 

RegionSales_JanSales_FebSales_MarSales Total
W1012830
E14101034

 

George

5 REPLIES 5
nick_ceneviva
11 - Bolide

The attached workflow should do the trick.  I use the Cross Tab tool to create Name - Value pairs and then filter the rows that just contain Sales in the Name.  The values are then summed and the total columns are rejoined to the original input on the record ID that was added using the record ID tool.

 

Capture.PNG

PeterGoldey
11 - Bolide

You should look at the options in the dynamic rename tool which is built specifically for this sort of thing - https://community.alteryx.com/t5/Alteryx-Knowledge-Base/Tool-Mastery-Dynamic-Rename/ta-p/32920

 

nick_ceneviva
11 - Bolide

Are you sure? I'm confused as to how you could use the dynamic rename tool to sum columns

PeterGoldey
11 - Bolide

My mistake - misread the question (which I thought was about the column labels).  

george_kwong
5 - Atom

Great, this works. Thanks for the help.

Labels