[SIP-22] Proposal for changes to time filter to allow for more flexible time range selections
[SIP] Proposal for changes to time filter to allow for more flexible time range selections
Motivation
Time is a first order dimension and the primary way to filter datasets. A few issues that need to be resolved:
- It is currently impossible to specify commonly filtered time ranges on recurring charts and dashboards. (ie. last full week, etc.)
- It is unclear to users what time ranges are being specified
- Date ranges are conflated with date+time ranges
Currently in Superset, there are a few different ways to specify a time range for a set of data in Explore View:

On the ‘Defaults’ tab, there are a few options here:
- No filter - no specified range; return all data
- All other options are presets filtering on time ranges relative to today. The units of time referenced here convert to # of days. For example:
- Week = 7 days
- Month = 30 days
- Quarter = 90 days
- Year = 365 days
#### On the ‘Custom’ tab, there are 2 options:
1. Relative to today is similar to Defaults, however this is flexible enough historical and future looking as well as controls on units of time
2. Start/End is pretty self explanatory. The one notable element here is the ability to use English to express time; however this is somewhat limited
#### All date/time ranges start at 00:00:00 time
Proposed Change
The main issues we need to solve are:
- Ability to specify relative dates that are not relative to today
- Ability to specify start of time units
- Clearly display time ranges being filtered for (Nice to have - improve usability by adding more common default time ranges)
Changes to Defaults tab
- Modify Defaults tab to organize by unit of time
- Add clarifying time range selected
- Augment default time ranges
- Add Week Start Date
- Modify months to be interpreted as calendar months (otherwise use weeks)
Changes to Custom tab
Mostly, the same with the following modifications:
- Add ability to anchor to specific date (defaulted to Today)
- Show selected time range
- Keep ability to do “english” language times (ie. 6 hours ago, now, etc. through Start/End dates)
New or Changed Public Interfaces
- Will need to keep superset tables that at minimum contain calendar months (ie. how many days in each month, etc.) if not standard time tables if eventually we want to get fancier with time ranges
Issue-Label Bot is automatically applying the label #enhancement to this issue, with a confidence of 0.91. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
@mistercrunch @xtinec @john-bodley @datability-io @betodealmeida
@john-bodley i think this is compatible with SIP-15's proposal. Am fine disregarding time in the Defaults->DAY and above unit of time options
@vylc I think these changes make a lot of sense and touch on some aspects of SIP-15 regarding explicit callout. A few comments/thoughts:
-
It's also worth pointing out that the current relative timestamp sometimes uses now and other times uses today as the reference point which is somewhat confusing.
-
Related to SIP-15 should we align on supporting dates and timestamps or just make everything timestamps? I proposed the former in SIP-15 but I'm not opposed to the later. Note there are other temporal grains; week, month, quarter, year etc. however we (and other BI tools) normally just encode these as dates (or timestamps), i.e.,
2019-01or2019-Q1is defined as2019-01-01. -
For
DAYI'm not sure that "Today so far (now)" should reference now as we're talking about dates and not times. I'm uncertain whether it should be[, today)(exclusive of today) or[, tomorrow)(inclusive of today). -
We need to ensure that the time window is apparent when the widget is closed.
-
From a UX perspective we're really specifying a time window either as: i) a start and and end, ii) a start with a duration, or iii) and end with a duration, and was wondering whether there was merit in trying to design/encode this into the widget somehow (which ties into #4).
-
We also have a time grain selector and wonder if it make sense to keep these decoupled or somehow combine them. I guess you could have a monthly time grain but the time filter is based on years (as opposed to months).
Also here is Looker's various date/time filters which provide some additional context regarding the various patterns they support.
I really like this proposal, as I often find myself needing an interval that isn't available. I recently opened a PR which solves a subset of this problem, namely the now/today one ( #7525 ), but I do feel that Superset would benefit a lot from adding more functionality in this space. I would like to add that Last Month or similar might mean very different things to different people; for one it means a moving window(e.g. 2019-04-30 to 2019-05-29) , while for others it usually means last full period (2019-05-01 to Today). This is often tightly coupled with time grains, and probably benefits from anecdotal analysis where the current functionality was insufficient.
Thanks for sharing this proposal! In the future when proposing a change to UX of the tool please add the label design-review.
- The number of defaults under for example the Default - Today tab is overwhelming. We should draw a thoughtful line around how many options we provide users. The more choices a user is presented with, the longer the user will take to reach a decision. Check out Hick's Law.
- This feels like a move towards supporting power user needs over general usability. It should be noted this provides greater friction for the non-power user. Having to select Today, Day, Week of Month first to find a specific default is not as user friendly/discoverable as it exists today. I question if some aspects of this should this live behind a more advanced option and/or feature flag for the time filter?
- I appreciate that you're trying to provide greater clarity of the selected time range for the user. The placement of the what I would suggest calling "Selected Time Range" looks like a bit of an afterthought right now. My guess is this a limitation of the tool you're using to mock this up in. It would be worth thinking about the hierarchy of information here. Rank it and order it as such. I would probably place the selected time range first. I think this is a great add all around.
- Week Start Day under Defaults > Week/Month is a bit hidden and unless I'm mistaken should probably be closer to the Today, Day, Week, Month selector.
• I like that we explicitly note the time range selected. The placement feels a little weird though; would like a design pass. Agreed with @john-bodley's point above that we should show this after selection as well. • I’m not sure about the [Today, day, week, month, year] drop-down in the defaults. It took me a while to grock, and I wondered at the number of defaults (could it lead to the paradox of choice?). It feels sufficiently complex that it feels like more than “Defaults” i.e. starts feeling "Custom." I think it's worth re-considering how we group these options at the highest level (relative / absolute seem like bigger distinctions, possibly). • I like all the changes to custom tab • I may be missing something, but I don’t think this actually solves the “Ability to adjust start time.” We could do that by adding a custom for the start date
@vylc @sylvia-tomiyama If there is alignment on the solution and it can be clearly documented I can take a pass at visually representing it. I don't have the cycles to get involved in the discussion or wait for it to land but I can mock up once we have a clear and unified vision.
Sylvia, note It might take time away from GMUI support as we try to launch.
Feel free to tag me here when it's ready.
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. For admin, please label this issue .pinned to prevent stale bot from closing the issue.