"Last N days" option in report date range picker
Right now, the date range picker (and the underlying filtering functionality) can only be used to set absolute "from" and "to" dates to filter data by, e.g. date >= 2020-02-01 AND date <= 2020-02-29
.
While a report about all of February 2020 would be interesting today, when March has just started, it will not be nearly as interesting 2 months from now, when February is long gone and the user would like to see how they did in April instead. To make the report show data from a more recent period again, the user currently needs to go into the report, manually update the date range, and save it. This action would need to be repeated for each report, once every so many days, week or months, depending on the date range chosen.
This is particularly problematic with the default reports we ship with each data source, which are currently stuck on the date range we set when we first created them, which may have been many months before the user set up the integration, for a date range they may not actually have imported data for.
To address this, we can introduce relative options to the date picker ("Last N days", where N is 7, 15, 30, or custom) that would result in date >=
and date <=
filters with relative values, like -7d
(to mean "7 days ago") and today
, that would be evaluated by the backend when the query is run and translated to an absolute date, or (more likely) a SQL date function.