Set default values for date Range as Today-7 & Today

We are using date range filter based on fields in Database as follows

from table1
created_at >= {{ date_from }} and
created_at <= {{ date_to }}

We need to set from date as Today - 1 and Today as ToDate

We can set values as specific date but not as today.

I tried with something like this but, getting error
created_at >= [[{{ date_from }}]]current_date

Can anybody please help me to solve this issue?

Hi @manish.joisar
You would have to add a comment syntax at the end of the optional clause:
created_at >= [[{{ date_from }} --]]current_date

But your query looks so simple, that you should be able to use Field Filters and just add a default value:

Hello Flamber

Thanks for quick response.

To add default value, i need to add actual dates, but what i need is today's-7 & today's date
So next month when i look at it, it should show the default dates accordingly.
Which i didn't got an option in default values

@manish.joisar That's because you are using simple Date filter instead of Field Filter, which allows relative dates - exactly what you are looking for.

Thanks for your reply.

When i open default value, i have to select dates only


@manish.joisar in "Filter widget type" change it to "Date Filter" - it should be called "All options", but that will give you a relative period.