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 | |||
Name | Cost | Name | Cost | |
A | 2,233 | A | 2,233 | |
B | 4,345 | B | 4,345 | |
C | 32,234 | C | 32,234 | |
D | 20,000 | D | 20,000 | |
New Cost | ||||
1,878 | 1,878 | |||
2,233 | 2,233 | |||
2,211 | 2,211 | |||
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.
Hi @Srinib . please refer to the screenshot if this is what you are trying to achieve?
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.
I hope this helps.
Thanks.