Alteryx Designer Desktop Discussions

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

Need to round off number based on condition

sgaryali
8 - Asteroid

Hi

 

I want to round off based on first decimal place only following the logic below :-

 

0.1 and 0.2 = 0.0

0.3 and 0.4 = 0.5

0.6 and 0.7 = 0.5

0.8 and 0.9 = 1.0

 

How can we do this please help

 

Thank you

6 REPLIES 6
Felipe_Ribeir0
16 - Nebula

Hi @sgaryali 

 

If your range of values is always between 0 and 1, you can use a formula like this one, just use the proper intervals: 

 

IF [Number]>=0.1 AND [Number]<=0.2 THEN 0.0
ELSEIF [Number]>=0.3 AND [Number]<=0.4 THEN 0.5
ELSEIF [Number]>=0.6 AND [Number]<=0.7 THEN 0.5
ELSE 1.0 ENDIF

 

Felipe_Ribeir0_0-1666870053881.png

 

Carlithian
11 - Bolide
11 - Bolide

If the condition isn't dynamic, this works :)

 

Carlithian_1-1666869850496.png

 

grazitti_sapna
17 - Castor

@sgaryali , If your condition is specific to some values then please use IF ELSE ladder in formula tool else you can use the solution provided by @Carlithian, in case you are following a criteria and the condition is not dynamic corresponding to input.

Sapna Gupta
ShankerV
17 - Castor

Hi @sgaryali 

 

Yes as per your requirement, it is possible to round-off.

 

1. Used the select tool to convert the number to string

2. Parse is used to split whole number and decimals 

3. Formula to based on your condition

4. Sum both whole number and output

5. Displaying the result

 

WhatsApp Image 2022-10-27 at 19.59.42.jpg

WhatsApp Image 2022-10-27 at 20.00.13.jpg

sgaryali
8 - Asteroid

Hi @ShankerV 

 

Can you please share the workflow

ShankerV
17 - Castor

Hi @sgaryali 

 

My Alteryx version is outdated and I couldn't save the workflow.

 

Have attached the tool in step by step, can you please replicate.

 

1.jpg

2.jpg

3.jpg

  

4.jpg

5.jpg

Labels