Alteryx Designer Desktop Discussions

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

Change number into percentage

joanq
7 - Meteor

hi all,

can you please help me with changing numbers into %?

I was doing tostring formulas * 100 but i've had pairse error...

below my data that i want to show as %:

joanq_0-1611125277541.png

 

5 REPLIES 5
AngelosPachis
16 - Nebula

Hi @joanq ,

 

Assuming that the field you want to convert to a percentage is called [Field1] and it's of a double/float/fixed decimal data type then your formula should be the following:

 

Tostring(Round([Field1],0.1)*100) + "%"

 

Inside the Tostring function, you are rounding the number and multiplying by 100 to convert 0.5 to 50%. If you don't need that then no need to multiply.

 

In case [Field1] is a string, then you should first convert it to a number, then round and then convert it back to a string to add the % sign. So that would look like

 

Tostring(

Round(

Tonumber([Field1]),0.1)*100)) + "%"

 

Hope that helps,

 

Angelos

Laurap1228
11 - Bolide

It is hard for me to see what your original data set looks like, but the main thing to remember is that you shouldn't be converting your numbers to strings with percent signs until the very end of your calculations.  You need them to stay Doubles (no rounding of decimal places) until after you've done all of the math.

 

See attached example

AngelosPachis
16 - Nebula

@Laurap1228  is right here, you should leave that conversion to a % format as the final step to your workflow, otherwise you will run into trouble when trying to use that field in any expression within Alteryx.

 

Thank you Laura for the the correction

joanq
7 - Meteor

thanks ! it worked.

Additionally I need to filter out anything below 85%.

Do you know how can I filter as now these values are as a string?

AngelosPachis
16 - Nebula

Hi @joanq ,

 

As Laura suggested above, the conversion should be one of the final steps in your workflow.

 

Keeping that in mind, you can add the filter before the formula tool that does the conversion, and in the configuration window, instead of filtering for 85, filter for 0.85 instead. 

 

Out of the T output anchor of the filter, you should only have those records that meet your criteria.

 

Labels