Rounding figures despite setting min d.p. in Native Query

Hi all,

When asking a native query of a view (lets say select * from Example View) the numeric figures are not displaying per the specifications I've set in the admin panel.

E.g. one field is called 'Commission Rate' - which is a percentage, that I have set with a 'Style' of Percent, and to min 3d.p. A given result has a full value of 17.50% in the view (i.e. a value of 0.175 in the database) and yet, the results of my 'select * from' return a value of 0.18.

Expanding the minimum number of decimal places in the native query formatting yields the correct result, but we are having issues with downstream reporting where the full value may not be persisted. Furthermore, I have specified this field to return as a percentage with min 3d.p. but it is being rounded. There seems to be no way to override what I assume is a very poor AI tool being used to format data in a certain way.

Has anyone else experienced this? Is there a setting I'm missing to override the AI? Is there a fix for this coming in later versions of Metabase?

Any response is appreciated!

Sol

Sol, most of the configs in Metabase are only applied to numbers in GUI questions, as Metabase doesn't know what will come from SQL questions. I suggest you use GUI questions as much as you can't to not get surprises in the number formatting

Can you reproduce the rounding issue with the sample dataset?
thanks

1 Like

Hi Luiggi, many thanks for the response.

I have recreated the issue with the orders table in the sample dataset by altering the config in the 'Data Model' section to present a minimum of 4d.p. in the 'Total' column - see below showing 39.7181 in the regular view:

...but showing 39.72 when accessed via a native query:

Let me know your thoughts.

as I thought, the display is only respected in GUI questions, not in SQL questions as Metabase doesn't know what's coming back from the DB in SQL questions

Thanks Luiggi - so Metabase team don't recognise this as a bug? Even though the value is being cut short direct from database?