Count Docs
Date ranges
How to create interactive date filters
This example shows how to built an interactive date filter. Date filtering is best done at the beginning of the notebook, as any further analysis can then continue from this filtered table, ensuring that everything is consistent. The end result will look something like the following:
An example of a date range filter in published mode
The minimum required steps are:
  1. 1.
    Create two date controls, with sensible titles for the reader - one for the beginning of the date range, and one for the end.
  2. 2.
    Use the values of these controls in the WHERE part of another SQL query.
In the example below, the reader is presented with a start/end pair of date pickers which influence the filtering in the filtered_tracks cell using a BETWEEN clause.
You may need to cast the value from a date picker to the appropriate datetime type to match your query.
An example of a date range filter in draft mode
Last modified 7mo ago
Copy link