Skip to content
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

No way to set current period as upper bound on query timeframe #5920

Closed
3 tasks done
jtalmi opened this issue Sep 18, 2018 · 6 comments
Closed
3 tasks done

No way to set current period as upper bound on query timeframe #5920

jtalmi opened this issue Sep 18, 2018 · 6 comments
Labels
good first issue Good first issues for new contributors inactive Inactive for >= 30 days

Comments

@jtalmi
Copy link

jtalmi commented Sep 18, 2018

The only options for setting the upper bound of the DateFilterControl dynamically with smart date parsing are:

  • last [period]
  • next [period]
  • today, yesterday, tomorrow

Selecting last [period] sets the upper bound as the beginning of that period, e.g. if today is Sept. 18 and I set the upper bound as "last month", the upper bound will be August 1, i.e. the beginning of last month, which makes sense semantically since the data goes up until "last month".

However, there is no way to set the upper bound as the current period as far as I can tell, and this is important for creating visualizations that only include full weeks/months/etc. of data.

Example: If today is september 18 and I want to include data up until Sept 1, i.e. the last full month of data, I need to be able to enter "This month" as the upper bound, which sets the time frame as < Sept 1.

I'd be happy to submit a PR to add a "This x" option to the DateFilterControl, but I wanted to make sure I wasn't missing something first.

  • I have checked the superset logs for python stacktraces and included it here as text if any
  • I have reproduced the issue with at least the latest released version of superset
  • I have checked the issue tracker for the same issue and I haven't found one similar
@jtalmi jtalmi changed the title No way to set upper bound on query time frame as "until current period" No way to set current period as upper bound on query timeframe Sep 18, 2018
@mistercrunch
Copy link
Member

@betodealmeida
Also for reference, we're powered (and limited) by the python libs we use for this parsedatetime and python-dateutil

@mistercrunch
Copy link
Member

BTW those libs are pretty powerful and can do much more than you probably think, statements like june or 2015 work as well.

It would be cool to show more of what's supported out of our time-parsing function, and what it currently resolves to. Maybe an info bubble with some suggestion and some label showing what relative times map to as the person types, shows an alert when it doesn't compute. We'd need to run async requests against a new endpoint here to do this.

@leakingoxide
Copy link
Contributor

Just to be sure: do we still want this new endpoint? Asking because the DateFilterControl widget and related code seems to have been updated quite often "recently".

If yes, I'd like to pick this up.

@mistercrunch

@mistercrunch
Copy link
Member

mistercrunch commented Nov 26, 2018

Related: #6360

@stale
Copy link

stale bot commented Apr 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive Inactive for >= 30 days label Apr 10, 2019
@stale stale bot closed this as completed Apr 17, 2019
@omkay
Copy link

omkay commented Sep 26, 2019

I know it's been time to this issue but I would like to share the trick I found for this issue
as superset is using parsedatetime to parse smart dates I have used the following sneaky trick to get upper bound for current month and the upper bound for the current week
one month after last month returns the start of the current month
three days after last week returns the start of the current week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good first issues for new contributors inactive Inactive for >= 30 days
Projects
None yet
Development

No branches or pull requests

4 participants