How can I use a filter to exclude dates?

Knowledge Drop

Last tested: Oct 7, 2019
 

The date options for a filter don't have one for "is not on the day". There is a feature request for that on our feedback system: Be able to filter for not a certain date (exclude a date).
 

We can use a custom filter with this syntax:

${orders.created_date} != date(2019,05,03)

another option is:

NOT matches_filter(${orders.created_date}, '2019/05/09')


and for dashboards or users who can't use a custom filter there is a workaround to use this filter declaration:

filter: exclude_dates {

description: "enter dates to exclude in the format yyyy-mm-dd"

type: string

sql: NOT {%condition exclude_dates %} ${created_date} {% endcondition %} ;;

}

This content is subject to limited support.                

Version history
Last update:
‎07-07-2021 01:14 PM
Updated by: