How to pass liquid parameters to `date` fields filters?
I can pass parameter to string filters like this
filters: [ date: "1 day ago" ]
but
filter: dt_filter {
type: date
}
measure: sum_filt_by_dt {
type: sum
filters: [ date: "{% date_end dt_filter %}"] #< --- Error here
sql: ${age} ;;
}
throws
Why it is possible for string fields but not for dates?
This works fine for unquoted parameters:
dimension: gender {
type: string
sql: ${TABLE}.gender ;;
}
...
filters: [ gender: "{% parameter gender_param %}"]
You can add a yesno dimension that uses your dt_filter and then use that in the measure filters
dimension: dt_yesno {
type: yesno
sql: {% condition dt_filter %} your_date_field {% endcondition %} ;;
}
measure: sum_filt_by_dt {
type: sum
filters: [ dt_yesno: "yes" ]
sql: ${age} ;;
}
I think why it works for you for the string fields is that you’re using a parameter there, which is a different thing than filter.