superset icon indicating copy to clipboard operation
superset copied to clipboard

A numerical range filter of the dashboard native filters does not allow to specify the exact value.

Open dinoel93 opened this issue 1 year ago • 1 comments

Bug description

A numerical range filter of the dashboard native filters allow only to use slider to specify the value. This may only be useful for selecting a variable within a small range. But in the millionth range, one sliders pixel corresponds to several thousand values. This makes it physically impossible to select the exact value.

How to reproduce the bug

  • Create the dataset with a large range of values in some column. Like 0-10M
  • Create some chart and dashboard using this dataset
  • Create a dashboard native filter with a numerical range filter type
  • Try to set a filter to the exact value. Like 3000001

Screenshots/recordings

Снимок экрана от 2024-03-22 14-46-39

Superset version

3.1.1

Python version

3.10

Node version

16

Browser

Chrome

Additional context

In addition to fixing this problem, I would like to know if there is a way to create a similar filter with the ability to define exact values in a different way.

Checklist

  • [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [X] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

dinoel93 avatar Mar 22 '24 14:03 dinoel93

I need the same feature

paulobitar avatar Jun 24 '24 21:06 paulobitar

How is this still not implemented? Seems like it would be a very common need. The bars are basically completely useless in the data I'm working with. One of the values I need to filter ranges from 0 to 3 million, so if you try to drag the left side of the range it immediately jumps to 16k or something like that.

cardilloscreations avatar Mar 14 '25 14:03 cardilloscreations

First of all, this seems to apply to single-sided and double-sided range sliders.

Fallback alternative

One alternative is to create separate text filters that can receive free input (accepting integer and decimal values). These filters might be called MyFieldMin and MyFieldMax. These can have default values of empty or of some reasonable values wanted for initial filtering.

Then, use those filter values as Jinja in the dataset. If they exist, do a >= and < to filter as needed.

Meta discussion on "How is this still not implemented?"

I don't know, but to improve the upon the current (awkward/suboptimal) filter implementation for numerical ranges with large ranges as tracked in this issue (e.g., large chunk sizing and difficulty getting slider to precise in-between values), I imagine it would be necessary to

  1. Identify a preferred design for the same inputs (select a numeric field and present its range) and
  2. implement that, get it approved, make sure it passes tests, etc.

Presumably, because Superset is an community open-source project, asking "why nobody has solved this open issue yet" is sort of like asking why anything hasn't happened -- maybe because

  • someone needs to do it in order it to be done,
  • or other things have been higher priority,
  • or not a lot of noise is made about it or it is not that visible of an issue,
  • or people end up falling back on another solution,
  • and/or something else, etc.

Moving forward

For (1) -- proposed design improvement -- I would think that a freeform text input field accepting numbers, positioned at the below-center position of each single-sided slider accepting numeric freeform input (or: one text input at each end, when it is a double-sided input), which then "jumps" the slider to that precise position inputted and "shows" that number (ideally as inputted [example: 2215 or 2,215] but, if easier to implemented or deemed more Superset-ish, conforming to the display format of the slider values [example: 2.2k]) would potentially be a solution design.

For (2) -- getting to resolving the issue -- I am not really in a position to develop this at this time, but I do empathize with the "too large grained of numerical range input sliders and inability to get needed values from them, even for somewhat reasonable if admittedly large-ish ranges" issue; hence, the comment.

u35253 avatar Mar 17 '25 20:03 u35253

Actually, it looks like a PR for precise bounds on numeric range filters based on the following comment: https://github.com/apache/superset/issues/31345#issuecomment-2634711615

u35253 avatar Mar 17 '25 20:03 u35253

Yep. The per fixing this did indeed merge. I'll close this as done, but we can re-open if that didn't solve it for you. Note that it hasn't been released yet, but we close issues when a solution is merged :)

rusackas avatar Mar 19 '25 18:03 rusackas