Hi everyone, I'm trying to set the date filter's default value to this month when the filter isn't chosen. Without input of Field Filter, where clause works fine, and shows correct (as expected) results, but once I put the filter into, it shows:
" No results!
My query:
Where DATE_TRUNC('month',CreatedAt) = DATE_TRUNC('month', [[ {{Selectmonth}}::date , ]] CURRENT_DATE() )
Any ideas what could be wrong, or this is a known issue and will not work as excepted?
Hmmm... It's a little hard to tell because the screenshot gets cut off, but it looks like you didn't include the closing parenthesis after {{Selectmonth}}::date. You need that to properly format the DATE_TRUNC call when there is a value provided for Selectmonth.
Here's the full line again:
where DATE_TRUNC('month', CreatedAt) = DATE_TRUNC('month', [[ {{Selectmonth}}::date) -- ]] CURRENT_DATE())
Note that you also need the closing parenthesis after CURRENT_DATE() for the cases where a Selectmonth value has not been provided.
It works fine in almost every case, but it doesn't work for pivot tables that can't use native SQL.
I'm trying to use field filter {{date_range}} instead of 2 single date filters like now. But I don't know how to set it as This month when nothing is chosen, it looks more complex than using 2 separate filters.
Do you have any idea for this case? Pls let me know
This new one looks like it might take more time to figure out than I can devote right now. I think it might be a good idea to post it as a new topic/question. That way, someone else might see it & be able to provide an answer