Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Andy Uttley, Alteryx ACE, makes music with Alteryx | Math + Music
SOLVED

Round 130.3155 to 3 decimal places....

Highlighted
8 - Asteroid

Sounds simple yeah?  130.3155 rounded to 3 dp is 130.316

 

Try this....

 

Round(130.3155, 0.001)

 

It gives 130.315 

 

Why? and how can I get round to behave as expected?

Highlighted
14 - Magnetar
14 - Magnetar
Will work on troubleshooting the Round function later, but you can try a
fixed decimal data type with 3 decimal places.

I'd do this in a select tool. set it to 9.3, so you have room for larger
numbers before the decimal point.

Let me know if that helps.

Cheers!
Esther

--
Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Hi @craigja,

 

It looks as though the round function is rounding it down. I'll take a look at why in a little bit.

 

However you could add 0.001 to your value to get around the issue: Round([Value]+0.001, 0.001)

 

image.png

 

If this solves your issue please mark the answer as correct, if not let me know!

 

Jonathan

Highlighted
8 - Asteroid

Hey @craigja 

 

So this is a really weird issue that I've seen other people discuss on the message boards. The workaround that I use is to separate the number into a whole number and decimal, round the decimal separately, and then add the two values back together. 

 

The formula to do it looks like the below. I've also attached a sample workflow for you. 

 

ToNumber(REGEX_Replace(ToString([Field1]), "\.(.*)",""))+Round(ToNumber("."+REGEX_Replace(ToString([Field1]), "(.*)\.","")),0.001)

 

Maskell_Rascal_0-1588785897096.png

Let me know if this works for you.

 

Thanks!

Phil

Labels