How to keep the trailing zeros after decimal point?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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%
Solved! Go to Solution.
- Labels:
- Expression
- Preparation
- Transformation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I chose 19.2 fixed decimal but that truncates the trailing zeros after decimal point
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
But it doesn't help me generate output with padded zeroes after decimal point even if I use the string function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks a lot, unfortunatley I can't open the file (you are on a more recent version error). Can you share a screenshot, maybe?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
