Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

ToString - adding percent sign to number

sswift13
7 - Meteor

I have a column of percentages that I would like to format as a percentage (ex: 75.3545%) rather than .753545

 

Currently, I have a formula tool inserted and am using 

 

ToString(Round(([column]*100),0.4))+"%"

 

I am getting an error message saying "Parse Error at char(0): Formula: tried to apply numeric operator to string value".

 

Currently, the column is being stored as "string" however I have also tried double, fixed decimal, int64, and v_string.

 

Is this the correct formula, and what type should the data be stored as? Does this hold true for converting data into dollars ($)?

4 REPLIES 4
PhilipMannering
16 - Nebula
16 - Nebula

That looks right. Just make sure [number] is a Float, Double or Fixed Decimal. And I think 0.4 should be 0.0001.

 

If you still continue to have issues, please share a sample of the data, and some helpful folk will share a workflow back with you.

 

Philip

sswift13
7 - Meteor

Thanks Philip! This worked to format both the percentage and dollar columns, however, the percent sign isn't showing up in the output, whereas the dollar sign is. This is the formula I'm using. The data is being stored as a fixed decimal of 100.4

sswift13_0-1614184411049.png

 

PhilipMannering
16 - Nebula
16 - Nebula

Number data types won't have any string characters. If you want a $ or % sign in your field then it has to be a string type.

 

You probably want to save as a new field (so you can save as string). The formula should be something like,

ToString( Round( [SFI Take Rate] * 100), 0.0001 ) + '%'

 

If your field should be numerical (so you can carry out numerical calculations on it) then you'll have to forgo the '%' or '$' sign. Alteryx won't show these for numeric fields.

lydabrown
5 - Atom

There are typos in the formula. Closing parenthesis after " * 100) " has to be removed. Another closing parenthesis has to be added after " 0.0001)". The below worked for me.

ToString(Round([SFI Take Rate]*100, 0.0001)) +'%'

 

Labels