Enable round function to round to specific number of decimals

Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,399 Neuron
edited July 2024 in Product Ideas
8
8 votes

New · Last Updated

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.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.