Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Decimal places

Isha_Gupta
8 - Asteroid

Is it possible to limit decimal places in a column without using table tool?

 

I have a alphanumeric column with some data as only numbers while some alphanumeric.

 

The ones which are only number are upto 9-10 decimal places, I only want them to be limited upto 5. No rounding off needed as well, even if after 5 decimal places, the rest is cut off, is fine by me.

4 REPLIES 4
alexnajm
18 - Pollux
18 - Pollux

Try setting the data type to Fixed Decimal with 19.5 specified. Or you can use a Round function in the Formula tool!

caltang
17 - Castor
17 - Castor

Working on @alexnajm 's suggestion, it looks like this:

image.png

 

But since @Isha_Gupta mentioned: 


@Isha_Gupta wrote:

Is it possible to limit decimal places in a column without using table tool?

 

I have a alphanumeric column with some data as only numbers while some alphanumeric.

 

The ones which are only number are upto 9-10 decimal places, I only want them to be limited upto 5. No rounding off needed as well, even if after 5 decimal places, the rest is cut off, is fine by me.


@alexnajm 's suggestion does round off to the nearest precision value. So it does not fit your exact criteria or no rounding off.

 

There is a great article here: https://databard.co.uk/mastering-rounding-in-alteryx/ fully on decimals. 

 

If you just want to "chop" the length to 5 without action, this is something you can do:

image.png

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
caltang
17 - Castor
17 - Castor

Hey @Isha_Gupta - did the above solve your need? If so, can you kindly mark the solutions above as accepted solutions so that we can close the thread + help others find the solution faster? Thank you!

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
apathetichell
19 - Altair

are there commas in your numbers? if no then regex_replace([my_text_column],"(\d+\.*\d{0,5})(\d+)","$1")

 

As I read this the column is a string - there are words - but also numbers. you want to identify what are the rows with numbers - and then truncate them. you would use some version of regex for that. My version would go in formula tool and would have [my_text_column] as your text column

Labels
Top Solution Authors