Alteryx Designer Desktop Discussions

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

How to add a title in between a numeric column

Srinib
5 - Atom

Hi, Can someone please help with the below requirement.

 

Need to perform union operation in 'cost' column, however need to add a title in between the numeric values as - "New cost". Currently when I tried this by adding "New Cost" as text input, the comma (,) disappears because the numeric changes to string value. How to retain the comma?

 

Input  Desired Output
NameCost NameCost
A2,233 A2,233
B4,345 B4,345
C32,234 C32,234
D20,000 D20,000
     
    New Cost
 1,878  1,878
 2,233  2,233
 2,211  2,211
     
     
2 REPLIES 2
Kenda
16 - Nebula
16 - Nebula

Hi @Srinib 

 

I made a simplified version of your data. I hope I'm interpreting your question correctly. Does the following expression help you?

iif([Field1]!="New Cost", tostring(ToNumber([Field1]),0,1),[Field1])

 

Basically, when you have text in a field, Alteryx will interpret that field as a string field. Therefore, if you want to automated adding the comma to a number, you have to change the value in a cell to a number then change it back to a string using the above expression. When changing the value back to a string, you can use a 1 to tell Alteryx to add comma separators in the number.

 

Kenda_0-1607700710438.png

 

 

grazitti_sapna
17 - Castor

Hi @Srinib . please refer to the screenshot if this is what you are trying to achieve?

grazitti_sapna_0-1607941810712.png

In case you are using an excel file which I suppose you do, then you can just check the first row contains data tab check as shown in the image below. This will read the column names as field name therefore I believe the issue of comma separated  numbers will be sorted then you can apply your logic for appending the New Cost title to the data or use the one I made.

 

grazitti_sapna_1-1607941888955.png

 

I hope this helps.

 

Thanks.

Sapna Gupta
Labels