Alteryx Designer Desktop Discussions

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

How to keep the trailing zeros after decimal point?

kunjanp
5 - Atom

So my Alteryx output truncates trailing zeros after decimal point which makes it difficult for me to apply string operations like add "%"

 

So something like this:

 

Alteryx Column

38.5

23.75

27

 

 Current Output by adding "%"

38.5%

23.75%

27%

 

Desired Output

38.50%

23.75%

27.00%

 

8 REPLIES 8
ddye
8 - Asteroid

Use the select tool - Change type column to Fixed Decimal - Change the number to the right of the decimal in the Size column to fix the number of decimal places you want to show. 

 

Believe that should work. 

 

Cheers.

tom_montpool
12 - Quasar

Changing the data type to Fixed Decimal n.2 will definitely fix the decimal place side of your question, however, you can't add the "%" symbol to the Fixed Decimal value.

 

To include the "%" symbol, you don't actually have to convert to Fixed Decimal first, instead you would need to create a new string field using:

 

ToString([ExistingField],2)+"%"

 

If you look a the help entry for the ToString Conversion function (https://help.alteryx.com/10.6/index.htm#Reference/Functions.htm#Conversion_) it shows that you can specify two parameters other than the field name:

 

ToString(x,numDec,addCommas)

 

Of course, if you have a ton of fields to do this on, use the Multi Field Formula tool.

kunjanp
5 - Atom

I chose 19.2 fixed decimal but that truncates the trailing zeros after decimal point

kunjanp
5 - Atom

But it doesn't help me generate output with padded zeroes after decimal point even if I use the string function

patrick_digan
17 - Castor
17 - Castor

You could use a text to column and then apply a formula tool using padright to ensure 2 decimals. This is certainly not the fanciest way to do it Smiley Happy

tom_montpool
12 - Quasar

This sample uses the example values you gave in your first post.

kunjanp
5 - Atom

Thanks a lot, unfortunatley I can't open the file (you are on a more recent version error). Can you share a screenshot, maybe?

tom_montpool
12 - Quasar

Open the yxmd file in a text editor

Change

<AlteryxDocument yxmdVer="10.5">

to

<AlteryxDocument yxmdVer="9">

 

Save it, and it should open up fine.

Labels