Home > Back-end >  DataStudio not to round the values
DataStudio not to round the values

Time:12-10

Please see if you can help .. is it possible for the DataStudio not to round the values ?.. For ex: I have this number: 1,628,63761056 But the DS rounds to 1628.64.. I need to keep the precision to 2 or 3 places. In other words, the correct value that the DS needed to show is 1628.63 and not 1628.64... Please, is it possible for the DS not to lease any value?

Another example, if I round the value 11,754.4747 to 3 houses, DataStudio shows : 11,754,475 and actually what I need is 11,754,474

Thanks.

CodePudding user response:

The floor function rounds to the lowest integer. I assume that you do not have negativ values.

FLOOR(VALUE_FIELD*100)/100

Another option, depending on the usage. A value can be cast to a string/text and be formated by any needs. Strings/texts can only be displayed in tables.

REGEXP_REPLACE(
REGEXP_REPLACE(
REGEXP_REPLACE(
REGEXP_EXTRACT(
CAST(dummy_val   0.000001 AS text )
,"([0-9]*[.][0-9]{3})")
, "([0-9])([0-9]{3})[.]", "\\1,\\2." )
, "([0-9])([0-9]{3})([0-9]{3}),", "\\1,\\2,\\3," )
, "([0-9])([0-9]{3}),", "\\1,\\2," )

In the line after the cast the number of digits after the decimal point are given by {3}.

CodePudding user response:

It became be possible for me with calculated field and ROUND built-in function:

  • Click Add parameter in chart settings, then Create Field
  • Place 'ROUND(field_name, 1)', if you want to cut decimals to 1 and name new calculated field.

Hope it helps.

  • Related