Enable round function to round to specific number of decimals

Turribeach
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,090 Neuron
edited July 16 in Product Ideas

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.

4
4 votes

New · Last Updated

Setup Info
    Tags
      Help me…