Between excludes the end date

When using sumif with between, the end date seemed to be excluded.

Using the sample data Orders table,
SumIf([Total], between([Created At], "2020-04-17", "2020-04-18"))
only give the total for 2020-04-17, but not 2022-04-18

擷取131
擷取132
擷取133
擷取134

Hi @xxx123
Post "Diagnostic Info" from Admin > Troubleshooting.

{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.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.16+8",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "11.0.16",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.16+8",
"os.name": "Linux",
"os.version": "4.15.0-184-generic",
"user.language": "en",
"user.timezone": "Asia/Hong_Kong"
},
"metabase-info": {
"databases": [
"postgres",
"sqlserver",
"h2"
],
"hosting-env": "unknown",
"application-database": "h2",
"application-database-details": {
"database": {
"name": "H2",
"version": "1.4.197 (2018-03-18)"
},
"jdbc-driver": {
"name": "H2 JDBC Driver",
"version": "1.4.197 (2018-03-18)"
}
},
"run-mode": "prod",
"version": {
"date": "2022-08-04",
"tag": "v0.44.0",
"branch": "release-x.44.x",
"hash": "d3700f5"
},
"settings": {
"report-timezone": "Asia/Hong_Kong"
}
}
}

@xxx123 You are using a datetime column, but only providing a date, which means it defaults to midnight. You'll probably want to do something like this:
SumIf([Total], between([Created At], "2020-04-17", "2020-04-18 23:59:59.999"))

Even with a date column, it behaves in the same way.

@xxx123 I cannot reproduce with the People.Birthdate, which is a date column.
Timezones are tricky, so maybe you are getting hit by that.
But definitely seeing this issue in play:
https://github.com/metabase/metabase/issues/20333 - upvote by clicking :+1: on the first post

Thank you for your reply.

Yes, it seemed to be related to timezone.
For the date columns, when we use "2022-06-30 08:00" , records on 2022-06-30 are included.
But when we use "2022-06-30 07:59" , records on 2022-06-30 are excluded.