Hi all,
I'm currently working on an issue to round the data to 5 decimal places. It is simple in excel, but I'm wondering how can it be done by alteryx.
The sample data has been attached.
Thank you so much.
hey @Paddi
you can use the formula below.
Round(Round([YOUR NUMBER FIELD], .000001),.00001)
Please accept as solution if this worked for you!
Hope this helps!
hi
you can use Round(ToNumber([number]),.00001)
hope this helps
please marked solved
@Paddi
Hi @Paddi
Please find my solution below.
If I understand your requirement exactly, where you need to round of to 5 decimal places.
Especially 2.682103 need to be round for 2.68210
If you use just Round([Field1], .00001) will give the output as 2.6821 and not 2.68210 which you are expecting.
So one step in additional implanted to get your expected solution.
Kindly accept this solution if it provided a solution to your question.
Many thanks
Shanker V
My workflow:
Step 1: Input
Step 2: Formula tool
Output as expected like 2.68210
Hi , this is Paddi's coworker, may i ask you to test 4.655665? it should be round to 4.65567, but failed by whichever solutions. Hope to know the reason.
@Fangfang @Paddi the following gets you to your expected outcome:
Round([Input], 0.000010)
Hi @Paddi @Fangfang
Please find the solution for your latest issue posted.
Step 2: Regex tool
Step 3: Formula tool
Round(tonumber([Field1]), .00001)
PadRight(tostring([Out1]),7,'0')
if([RegExOut1]='5')then tonumber([Out1])+0.00001else [Out1]endif
Output:
hi DataNath, thanks seems easy and clean, but may i also ask to keep 0 if decimals shorter than 5? such like 4.35 to 4.35000?
hi @Fangfang
Hope you have checked my solution to overcome the issue of 0 at end.
@Fangfang sure, in my previous output I had the output data type as a double. If you just change it to fixed decimal with a scale of 5, it'll automatically populate the extra trailing zeros without any change to the expression needed:
hi DataNath,
sorry failed from my side.
hi ShankerV, thank you for your kindly help, but your solution seems a little more complex to me. My original workflow had been too long and too many tool, this is a part of it. So i would like to use an easy way to deal it now. But I will study careful about yours later. Thank you so much again.