How to set the current date (or the date relative to the current date) as default query parameter


#1

Is it possible, for example, to make my query show the statistics for the last 30 days by default as well as be able to accept arbitrary beginning and ending dates?


#2

I have the same question,
if I need to use by default current_date as input parameter if there was no parameter in form like:
select
CASE
WHEN ‘{{start_date}}’ is NULL THEN current_date
ELSE ‘{{start_date}}’
END

Now if I don’t specify {{start_date}} value and run the query above it returns the error:
“Error running query: missing value for start_date parameter.”


#3

I have the same question.
I have a parameter to set dates and would like to use the current date as default value for the query.

Anyone?
Thanks!


#4

Same question. I’m aware defaults are those that were set when saving the query, but this isn’t useful with dates. Need something like dynamic default query parameter.


#5

need too, hope the date range has the current date as the default value


#6

Since V5 the date/datetime parameters can take current date as default value (open the settings to set this). In future versions we will allow more default options and extend this support to date range parameter.


#7

great! I use the redash-v5, now I can just set the start date and end date ,but the end/start date we hope it can be a dynamic date .example ,the date range may be one month, and the start/end date can be dynamic