+1 vote

I have numbers like that in my dataset:

I want to concatenate them but using a normal decimal format such as 0.0008

How can I do that ? I know I can use Python but I'd prefer not to

asked by anonymous

1 Answer

+2 votes
Best answer

Hi,

You can use the "format" function of the formula language.

This function takes a "printf format string" and applies it to any value.

In your specific case, if you want for example 5 decimal places, use:

format("%.5f", my_column_name)

Format strings are immensely powerful, they allow you to truncate strings, change precision, switch between numerical notations, left-pad strings, pad numbers with zeros, ...

More information about format strings:
https://en.wikipedia.org/wiki/Printf_format_string

DSS formula use the Java variant of format strings:
https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#summary

For more information about formulas, see:
https://www.dataiku.com/learn/guide/code/misc/formula-master.html
http://doc.dataiku.com/dss/latest/advanced/formula.html

 

answered by
selected by
893 questions
923 answers
905 comments
1,433 users