@jl-thirdwave
Is showing these three custom date ranges important or are you just looking for relative date range filtering?
I will explain both options starting with relative date range filters.
Relative date filtering
With the visual selected, add a filter on the date field.
Change the Filter type to Relative dates, Period to Days, Range to Last N days and put in a starting default for the Number of days as (say) 30.
Click Apply and the visual will filter down to the above setting.
Click the ellipsis against the filter name and then Add to sheet.
You will now have a relative date control on your sheet and this will let your users control the relative filtering as desired (even changing the period from days to month, year etc)
Note - The relative date range is calculated from UTC. If you need it calculated based on a custom time zone, you can pass in that date and time value as a parameter.
Custom date filtering
On other hand, if your intent is just to give users the three preset options calculated against now() as you mentioned in your second question, you can do the following.
Create a single value string parameter and create a control on top of that with the three static values (7d, 1m, 3m). I assume that is what you already did to capture the screen shot.
Next, create a calculated field to drive the date inclusion/exclusion. (See below)
Date Filter
ifelse (
addDateTime(-7,'DD',now()) <= {Order Date} and {Order Date} <=now() and ${pDateRange} = '7d', 'Include',
addDateTime(-1,'MM',now()) <= {Order Date} and {Order Date} <=now() and ${pDateRange} = '1m', 'Include',
addDateTime(-3,'MM',now()) <= {Order Date} and {Order Date} <=now() and ${pDateRange} = '3m', 'Include',
'Exclude'
)
Then, create a filter for the visual using the above Date Filter calculated field and set it to pull in only ‘Include’ value.
Marking this as solution to your question. Please let us know if you have more questions.
Regards,
Arun Santhosh