Cannot bind relative date filter on dashboard to sql variable of date type
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 49.3k
- Forks
- 6.8k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 653
Description
Describe the bug
Relative date dashboard filter can only be bound to SQL variable of Field Filter type.
The workaround is to use single date type but that widget lacks relative date selection and relative default value.
To Reproduce
- Create dashboard
- Add SQL Question with
{{since}}variable of Date type - Save and back
- Add dashboard filter
Sinceof relative date type - Attempt to bind it to previously defined variable
Not possible, have to change dashboard filter to single date.
A date variable in this card can only be connected to a time type with the single date option.
Expected behavior
It should be possible to bind relative date filter to Date variables.
Previous 7 days would become current_timestamp - interval '7 days'
Or perhaps Relative and Single date modes should be merged and the widget allow both types of selections.
Logs
No response
Information about your Metabase installation
{
"browser-info": {
"language": "en-US",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36",
"vendor": "Google Inc."
},
"metabase-info": {
"databases": [
"postgres",
"h2"
],
"run-mode": "prod",
"plan-alias": "",
"version": {
"date": "2026-02-24",
"tag": "v0.58.7.4",
"hash": "93cd8a0"
},
"settings": {
"report-timezone": null
},
"hosting-env": "unknown",
"application-database": "h2",
"application-database-details": {
"database": {
"name": "H2",
"version": "2.1.214 (2022-06-13)"
},
"jdbc-driver": {
"name": "H2 JDBC Driver",
"version": "2.1.214 (2022-06-13)"
}
}
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "21.0.10+7-LTS",
"java.vendor": "Eclipse Adoptium",
"java.vendor.url": "https://adoptium.net/",
"java.version": "21.0.10",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "21.0.10+7-LTS",
"os.name": "Linux",
"os.version": "6.6.119-0-virt",
"user.language": "en",
"user.timezone": "GMT"
}
}
Severity
Annoying
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the dashboard and SQL Question steps with a Date variable and a relative date filter. Trace where dashboard filter bindings reject Date variables and how relative values are converted for SQL. Done means the binding succeeds and a selection such as “Previous 7 days” is passed as the expected date expression, with coverage for the regression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure, sql
- Domain
- backend, databases, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100