View the original community article here
Last tested: Jan 27, 2021
This works if a user would like to be able to select a date, and then a number of days they'd like to see before and after the selected date. For example, if I selected 10 and Mar. 14, the resulting date range would be Mar. 10 - Mar. 24.
Here's the lookml:
parameter: number_of_days_test {
type: number
}
filter: date_selector_test {
type: date
sql: ${created_date} >= date_add({% date_start date_selector_test %}, interval -{% parameter number_of_days_test %} day)
AND
${created_date} <= date_add({% date_start date_selector_test %}, interval {% parameter number_of_days_test %} day) ;;
}
dimension_group: created {
type: time
timeframes: [
raw,
time,
date,
week,
month,
quarter,
year
]
sql: ${TABLE}.created_at ;;
}
This content is subject to limited support.