Hey,

I have two parameters {{ Start Date }} and {{ End Date }} and I would like that the Start date always defaults to for example: 7 days ago, 14 days ago, 30 days ago so the dashboards would be easier to use. User should be able to still modify the date in the calendar if he needs. Is this possible in the current 7.0 Redash and if so how?

I think if you’re using ‘Date’ as your parameter type, then you can only default to today.

What I have done in this case is created a separate meta table with the date off-sets, eg
value | name
0 | Today
-1 | Yesterday
-2 | Previous Day

Then in my query, I set my parameter type as ‘Query Based on Dropdown List’ and mapped it to the meta table.
The SQL Query then uses a date offset using the value from the meta table
cast(DATEADD(d,{{Date to Run For}},getdate()) AS date)

I then get presented with a drop down with a set of values for running the query. If you pre-populated this and used it as a ‘start’ and ‘end’ date parameter, you can then have it default to ‘7 days ago’ for your start date

This may not be great if you’re dealing with a broad range of dates, but if it’s always within last 10 days for example, you should be ok

1 Like

I like the idea, but in our case we would be looking it normally 7/14/30 days, but the user needs to be able to see as far as how the situation was last year at the same date in easy dynamically changeable way.

In Kibana :

Implemented :innocent:
Available on the next stable release v8 (already available on the hosted platform).

1 Like