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 get % sign in Output

rushabh_shah
8 - Asteroid

I am using the Formula node to divide two fields (say 5/10). The output gives me 0.50 but i am looking for it to show as 50%.

 

Can anyone help?

 

Regards,

Rushabh

10 REPLIES 10
MarqueeCrew
20 - Arcturus
20 - Arcturus

Hi @rushabh_shah!

 

Not to worry, help is here.  You'll want to calculate the value and then convert it to a string where you'll add a '%' sign to it.

 

Given that you define your [Output Field] as a vString....

 

ToString([Field 1] / [Field 2] * 100,2) + '%'

This formula will turn 5 divided by 10 into 50.00%

 

The second parameter in the ToString function is the number of decimal places.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
rushabh_shah
8 - Asteroid

Thanks for the help Mark. 

 

One question, won't we miss the decimals in this case, since we are converting to string?

 

Regards,

Rushabh

MarqueeCrew
20 - Arcturus
20 - Arcturus

How many decimal places are you looking for?

 

ToString([Number],[How many decimal places) + '%'

 

if number = 12.34567 & how many decimal places = 4

then result = 12.3456%

 

if how many decimal places is left out of the equation of ToString([Number])+'%'

then result = 12.34567%

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
cmcclellan
13 - Pulsar

Yes, you will miss decimal places.  By converting to a string you will also lose the ability to perform other math calculations on this field.  I'd suggest leaving it as a number (float?) and then formatting it in your presentation to show percentage sign with X decimal places.  Even Excel does it that way.

noemizito
5 - Atom

I am sorry to jump on this conversation, but I have the same problem with number formatting in Alteryx.

To be precise, Excel does not do it in this way, Excel lets you change the format of a cell and show that as a percentage keeping the number format in case you want to perform any operation on that number.

I think that this kind of things should be definitely implemented in Alteryx, they are very simple things but that change much the output quality and make it readable. Did anyone already think about that?

96sudeshnasen
7 - Meteor

I tried this method of using toString() but it throws an error. 

 

Formula (7) The formula "curr_qtr_revised_conversion" resulted in a string but the field is numeric. Use ToNumber(...) if this is correct. (Expression #1)

 

kneri3
7 - Meteor

Is there a way to add a % sign without converting it to a string. When i tried using this formula, i'm getting an error saying that the formula resulted in a string when the field is numeric... is there a way to fix that?

amazz24
7 - Meteor

Hi Kneri3 - You could use the reporting tools to render your output.  Use the table tool to add % sign as a suffix to the necessary fields, then output using the render tool.

prinkle
5 - Atom

Hi Meteoroid, 

 

Thanks for this, it worked for me too !

 

 

Labels