New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add relative date "before" filter #4083
Comments
You can just add 2 filters This is easy enough to do using two filters, and we're not likely to add more complexity to single filters when it's easy enough to compose. |
Looks like I don't see. Could you point it? |
@shamruk try something like |
I see MySQL have variables (witch would let me make what I want) and mongo does not |
You don't need variables for this the dates are relative to whenever the query is ran |
Before is not relative https://yadi.sk/i/voWpScp538sTyA |
@shamruk you can just upload images directly to the GH thread (just drag them into the text box) |
@shamruk actually, you're correct regarding there not being a relative "before" filter. |
By the way I have managed to workaround this problem editing metabase configuration in DB. But got some strange problem: {
"$match": {
"$and": [
{
"time~~~day": {
"$gt": {
"___date": "2017-01-12"
}
}
},
{
"time~~~day": {
"$lt": {
"___date": "2017-01-13"
}
}
},
{
"time~~~hour": {
"$gte": {
"___date": "2017-01-12T01:00:00"
},
"$lte": {
"___date": "2017-01-14T00:00:00"
}
}
}
]
}
} |
And I cannot fix native query myself because all dates will be fixed (not relative) and there are no variables in mongo to overcome this. Looks I'm stuck now with this 3 problems |
Ideally, it would be good to have a relative option in these date filters:
After that change, previous and next may not be needed at all - it would be the same as between 1 month and yesterday for example |
It could be done if Metabase supported the Date constructor, so we could do something like this:
|
We could really do with this... @ipeevski – did you ever figure this one out? |
I think latest metabase has a few more options around dates and seems to be less of an issue, but haven't found a specific solution to the original query |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Date After -x Days , Date Before -y Days can be done using native query
1 day = 86400000 |
This comment has been minimized.
This comment has been minimized.
While it looks like it will be possible to formulate expressions like |
Coming in 0.43 - there's a separate requests for relative between, which is possible with a little hacky workaround #21976 |
I have a Mongo database. I want to get all records in a range between 3 days ago and two days ago. Sounds as a common request.
I have not figured out how to make it using gui and tried to use native query but it immediately converts relative dates like "yesterday" to a fixed day like 05.01.2017.
As I cannot use js in native query and write something like "new Date()" is there any way to make relative dates possible.
I could be done with some simple convention where you replace some MetabaseDate.daysAgo(3) to "03.01.2017" before running a query.
Looking forward to your reply, thanks for creating such a great tool.
PS or point me to the class where I could add such feature
⬇️ Please click the 👍 reaction instead of leaving a
+1
orupdate?
commentThe text was updated successfully, but these errors were encountered: