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

Support rolling filters for date time cols #2877

Open
aszenz opened this issue Dec 12, 2024 · 1 comment
Open

Support rolling filters for date time cols #2877

aszenz opened this issue Dec 12, 2024 · 1 comment
Labels
enhancement Feature requests or improvements

Comments

@aszenz
Copy link
Contributor

aszenz commented Dec 12, 2024

Feature Request

Ability to always look at last quarters data for saved report

Description of Problem:

I want to create a dashboard which always shows last quarters data by default but include all the data. I also want to support my users in customizing the range of data they want to look at easily.

Potential Solutions:

Support rolling filters on date time columns:

  • Previous/Current/Next quarter/month/week/year

On every load it should fetch the current date time and filter the data accordingly.

@texodus
Copy link
Member

texodus commented Jan 9, 2025

For static data, Perspective has partial support for this feature via a mix of the datetime() and now() ExprTK functions but it's not super ergonomic and has some quirks:

{
   // ...
  "filter": [
    ["is_within_last_five_minutes", "==", true],
  ],
  "expressions": {
    "is_within_last_five_minutes": '"my_datetime_column" > datetime(now() - 1000 * 60 * 5)'
  },

}

Unfortunately, for now Perspective columns do not re-calculate if their inputs don't change, so this won't work with streaming data and the cutoff value is basically frozen once the View is created.

@texodus texodus added the enhancement Feature requests or improvements label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests or improvements
Projects
None yet
Development

No branches or pull requests

2 participants