Start Free Trial

Alteryx Designer Desktop Discussions

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

Rounding Formula

jessy_chow
8 - Asteroid

I have a set of data that contains positive and negative numbers. 

I would like 12.5 to round to 13 and -1.5 to round to -1. 

When I use the round([number],1) function, 12.5 goes to 13 but -1.5 rounds to -2.

Thanks! 

5 REPLIES 5
ScottLewis
11 - Bolide

Do you want the rest of the numbers to round normally? Meaning do you want -1.6 to round to -2?

If so, you're really just specifying one special case and we can do this with a conditional.

 

if [Number]<0 && [Number]-floor([Number]) = .5
then [Number]+.5
else round([Number],1)
endif

 

Should do the job though there might be a more elegant way.

 

 

 

 

KGT
13 - Pulsar

Is this in Designer Desktop, or Designer Cloud? I am not sure how it works in Designer Cloud.

 

In Designer Desktop, Round([Field1],1) enacted on [Field1] as a Double works as you have said you would like. I actually answered a question on this the other day and found that's exactly how it works. I'm not sure how you're getting -2.

 

See the help here for details.

Manoj_k
9 - Comet

Hi you can use the formula 
IIF([Number] >= 0,
Floor([Number] + 0.5),
Ceil([Number] + 0.5)
)

attached an screenshot for the same.

aatalai
15 - Aurora

@jessy_chow   You can use

CEIL([Field1])

 

caltang
17 - Castor
17 - Castor

@jessy_chow use @aatalai 's method:

 

image.png

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Labels
Top Solution Authors