Unable to use formatting for numbers, i.e. decimal places (MongoDB)

I have 2 fields in my table, namely Agent Rating and Customer Rating. I use the Average option under View. Both are numbers, but for Customer Rating, the average comes, say 2.34, only two decimal points, and I can configure it using the Formatting option. But for Agent Rating, I see something like this 2.0086206896551726 and there are no formatting options.

Can anyone help me with this?

Hi @mrudul.n
Which version of Metabase?
What is the Field Type? Admin Settings > Data Model > (database) > (table) > (column) :gear:
And what’s the actual column type in your database?

1 Like

Hi @flamber

Thanks for responding. I am on version 0.31.2.

The field type is Score. I do not see anything in the formatting tab. The actual column type for Agent Rating is String, whereas for Customer rating column, it is int. But the table I am using for Metabase visualisation, has both the columns types in int (using $toInt to convert Customer rating to int).

@mrudul.n
Okay, so it sounds like it’s a string problem. You say that you’re converting Customer Rating to Integer, does that mean you’re not converting Agent Rating?
Metabase only has those formatting options for numeric values.

@flamber
Apologies if I wasn’t clear enough. By default, in the database, we have Customer rating in Int and Agent rating in string (both have the same values ranging from 0 to 5). The table I am using for Metabase, has been exclusively made for metabase, and I changed Agent rating to Int type ( “agent_rating” : {"$toInt" : “$agent_feedback.rating”}, ) I didn’t have to change Customer rating column, because it was already in Int.

As both are in Int, I am assuming both are numeric values.

Can you change Field Type from Score to nothing (think it’s at the bottom) and then clear cache and re-scan field.
Otherwise I would suggest that you try the newest version - 0.32.8 - remember to backup before upgrading, so you can revert if something else is not working.
If neither changes anything, then I’m out of ideas, what could be causing this.

I tried everything you asked. Sadly still not working.

I had the same issue and I realised that the underlying data format(in BigQuery) was BIGNUMERIC which Metabase handled weirdly. But after changing the format to FLOAT64, the formatting issue was resolved.
Hope this helps someone.