Trend Visualization not working - Group by a time field to see how this has changed over time

Hey Team,

I got an error message when trying to use Trend visualization: Group by a time field to see how this has changed over time

here is my scripts

select sum(cost) from aws
where service like '%Relational%'
and time_period > now()-interval 1 month

The table result is like the pic below, but it's wrong when I use Trend:

Diagnostic Info

{
"browser-info": {
"language": "en-GB",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.14.1+1",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.14.1",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.14.1+1",
"os.name": "Linux",
"os.version": "4.14.248-189.473.amzn2.x86_64",
"user.language": "en",
"user.timezone": "GMT"
},
"metabase-info": {
"databases": [
"mysql",
"bigquery",
"h2"
],
"hosting-env": "unknown",
"application-database": "postgres",
"application-database-details": {
"database": {
"name": "PostgreSQL",
"version": "12.8"
},
"jdbc-driver": {
"name": "PostgreSQL JDBC Driver",
"version": "42.2.23"
}
},
"run-mode": "prod",
"version": {
"date": "2022-04-07",
"tag": "v0.42.4",
"branch": "release-x.42.x",
"hash": "7c3ce2d"
},
"settings": {
"report-timezone": null
}
}
}

Can somebody please help me on this?

Thanks.

Hi @kamil717
You need to return 2 columns. A time-based column and a numeric-based column.
https://www.metabase.com/docs/latest/questions/sharing/visualizing-results#trends
Try using GUI instead of SQL, it makes it a lot easier for Metabase handle it.
Also, latest release is 0.44.2: https://github.com/metabase/metabase/releases/latest