Dashboard Date range filter is not working.
Welcome to the forum.
The query fails because:
- Your WHERE clause is invalid:
- You didn’t specify which field to filter on
- You didn’t use valid syntax for filtering by dates (use < or > or
BETWEEN
)
- You need to wrap date parameters in single-quotes, else they are interpreted as integer subtraction: 2021-01-11 == 2009.
Fix as follows:
-- incorrect
WHERE {{ somedate.start }} {{ some_date.end}}
-- correct
WHERE some_field BETWEEN '{{ somedate.start }}' AND '{{ some_date.end}}'
--alternative
WHERE some_field >= '{{ somedate.start }}'
AND some_field <= '{{ somedate.end }}'
Thanks, Jesse for the quick response.
I tried both solutions. But now there is two problems one, instead of two date box its showing only one box to select date.
Click the gear icon above the parameter input widget and set the Type to Date Range
.
As suggested, I changed the parameters to Date Range. But now there is no Data after applying the changes, where the data is available on a particular date.
- Are you certain data should be available for this range? How do you know that?
- Have you tried to widen your date range? What was the effect?
- Whatbither debugging steps have you tried?
Without more information I don’t see a bug here. I’d recommend reading the documentation page about how to use query parameters.
Here for your reference.
First screenshot, you can see data is available from dated: 19-05-2017
In 2nd below snapshot, you can see while selecting the date range, the data is not visible.
no query result.
I think this is a date-formatting issue. What happens if you run the query but actually type the ISO8601 dates, instead of using the parameter?
What type of database do you use?
If your database expects dates to be written in DD/MM/YYYY format then Redash’s parameters wont’ work.
Hi, Please find the answer of your queries:
We are using Source Database is Amazon Redshift (Actual Datasource MySQL)
Date format in DB is YYYY-MM-DD
But in Redash it is showing as an DD/MM/YY.
PFB snapshot of first query:
Hi jesse,
Did you get the chance to review this issue?
Your support in this regard would be highly appreciated.
Have you tried changing the default date formatting on Redash to see if this is a format bug?