Why is summarizing by average rounding it off to the nearest integer?

Hi,

Summarizing a field by average is rounding it off to the nearest integer. Is this expected? or should I do something to get the answer to 2 decimals?

Hi @teja
Please post “Diagnostic Info” from Admin > Troubleshooting.
Which database type are you querying?
What is the Field Type of Order Age in Admin > Data Model?
And what’s the actual database column type?

What does your database return if you make the query manually in SQL with the avg() function?

Hi @flamber,

Please find the information you asked below.

 {
  "browser-info": {
    "language": "en-US",
    "platform": "MacIntel",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.7+10",
    "java.vendor": "AdoptOpenJDK",
    "java.vendor.url": "https://adoptopenjdk.net/",
    "java.version": "11.0.7",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.7+10",
    "os.name": "Linux",
    "os.version": "4.14.181-108.257.amzn1.x86_64",
    "user.language": "en",
    "user.timezone": "GMT"
  },
  "metabase-info": {
    "databases": [
      "mysql",
      "h2",
      "redshift"
    ],
    "hosting-env": "elastic-beanstalk",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "10.6"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.2.8"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2020-05-28",
      "tag": "v0.35.4",
      "branch": "release-0.35.x",
      "hash": "b3080fa"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

Database Type - Redshift
Field Type of Order Age - No special Type with Number format with 2 decimals
Actual database column type - int8(19)

If I run the query manually, it is also returning results in integers. Should I have to cast the actual database column to float?

@teja Yes, you only have integers (no decimals), so it will only return that. You need to use float (or similar) if you want the query to return decimals. Metabase cannot get more information from a query than what is returned.