I currently have a custom field called DateSeries which is linked to a parameter and some filters. It allows the user to choose between Daily, Weekly (Mon-Sun) and Monthly.
I want to make it so when you select Daily, it only shows the last 30 days and/or toggles Show Data Zoom for the x axis. The way its currently setup, when you show daily it shows several months of daily observations and looks crowded. Ideally I want to control the number of days or weeks shown depending on what the user selects. e.g., 30 days for days, 20 weeks for Weekly (mon-Sun) and 12 months for month.
The code for the custom field
ifelse(
${aggregation} = 'Daily',
truncDate('DD', Date),
${aggregation} = 'Weekly (Mon-Sun)',
addDateTime(
1,
'DD',
truncDate(
'WK',
ifelse(
extract(
'WD',
Date
) = 1,
addDateTime(
-1,
'DD',
Date
),
Date
)
)),
truncDate('MM', Date)
)