Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Added on February 19, 2024 4:14PM
Likes: 8
Replies: 0
There doesn't seem to be a built-in formula language function that can round a number to specific decimals. The existing round() function only allows to round a number to the nearest integer. So we found two ways of doing this within the formula language (samples given rounding to 1 decimal place):
Format to 1 decimal and convert back to Number:
toNumber(format("%.1f", Double_Number))
Use multiple and divide by 10 before and after using the round() function:
(round([my_column]*10))/10
However it will be best if Dataiku supported the most common way of using a round() function:
round(column, [number_of_decimals])
In order to maintain compatibility with older code the new number_of_decimals parameter should be optional and default to zero so existing code will not be affected by this improvement.