Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Rounding - Why is it so hard?

ScottShimer
7 - Meteor

Attached is a workflow where i have a list of values that may be up to 4 decimal places long.  I want to round them to 2 decimal places for display purposes in a chart.  It seems like I should be able to change the field type to "Fixed Decimal" and designate 2 decimal places.  However,  for some reason that field type has something called a "Scale"?  What is that?  Why is it?

 

I have tried using the Round(value, 2) function with different types of number fields, but have not found the secret combination to get 2 decimal places.

 

How can I get the values rounded to 2 decimal places?

 

And, if anyone knows, why has Alteryx made something that is so simple so counter-intuitive (at least for me)?  

 

Thanks,Scott

 

7 REPLIES 7
ChrisTX
16 - Nebula
16 - Nebula

Round(1.25, 0.1) returns a value of 1.3

Round(1.227, 0.01) returns a value of 1.23

 

Here are all of the math functions: https://help.alteryx.com/current/designer/math-functions

 

Chris

ScottShimer
7 - Meteor

Thanks, Chris,  It is not difficult, if you know the syntax.  But it does not address the other part of my question, what is the "Fixed Decimal" field type for, if not setting a fixed decimal field, and what is scale?  Also, the round function in Alteryx seems very different than other tools and languages I use, it would be good for Alteryx to try and standardize, less deviating provides significant value.

 

All that said, I do appreciate your feedback!  🙂

 

Regards,

Scott

 

 

ScottShimer
7 - Meteor

As a follow-up, your suggestion about the formula works, but the Interactive Chart tool seems to ignore the formula output.  See the attached screenshots.  The data type in the formula is "Float", Size = 4.  

fmvizcaino
17 - Castor
17 - Castor

Hi @ScottShimer ,

 

I think Alteryx opted to describe the data formats in a more technical way so it would be 'easier' to distinguish one from another. It is the same issue when explaining the 4 different types of string instead of just calling text.

 

About the fixed decimal:

Precision refers to the maximum number of digits that are present in the number. 

Scale of a number is the number of digits after the decimal point.

 

So 19.99 has precision 4 and scale 2.

 

Best,

Fernando Vizcaino

grazitti_sapna
17 - Castor

Hi @ScottShimer , change the column value datatype to double then use formula tool using formula Round(value,0.01). This will work, please refer to the screenshot for better clarity.
Thanks.

grazitti_sapna_0-1592888292469.png

 

Sapna Gupta
ScottShimer
7 - Meteor

Thanks, I did finally get the correct combination of formula and data type, which worked.  I also tried using the fixed decimal after finding the explanation you provided, but could not get it to work the way I expected based on the explanation.

 

I appreciate your feedback on the why of the complexity and I agree that string data types have the same issue.  I have listened to the training videos and the data types are explained, but I do not understand the need for the complexity?

 

I believe the tool would be much more intuitive if Alteryx consolidated some of those data types.

 

Thanks again!

Martin_F
6 - Meteoroid

Solution

 

thanks!

 

Labels