Skip to main content
Using filters
{% table_filter
    id="my_filter"
    data="demo_daily_orders"
/%}

{% bar_chart
    data="demo_daily_orders"
    x="date"
    y="sum(total_sales)"
    filters=["my_filter"]
    date_grain="month"
/%}

Examples

Using filters

Using filters
{% table_filter
    id="my_filter"
    data="demo_daily_orders"
/%}

{% bar_chart
    data="demo_daily_orders"
    x="date"
    y="sum(total_sales)"
    filters=["my_filter"]
    date_grain="month"
/%}

Using Inline SQL

{% table_filter
    id="my_filter"
    data="demo_daily_orders"
/%}

```sql filtered_orders
select * from demo_daily_orders
where {{my_filter.filter}}
```

{% table data="filtered_orders" /%}

Attributes

id
string
required
Unique identifier for the filter component
className
string
Additional CSS classes to apply
data
string
required
ID of the table to filter
defaultConjunction
string
default:"AND"
Default conjunction between filters (AND or OR)Allowed values:
  • AND
  • OR
columns
array
Array of column IDs to filter on. If not provided, all columns are available for filtering
labels
array
Array of custom labels to display instead of column names. Must match the order of the columns array.
showClearButton
boolean
default:"true"
Whether to show a clear button to remove all filters
minimumRecords
number
When set, string filters will only show values that have at least this many records, and filters will always use AND conjunction
width
number
Set the width of this component (in percent) relative to the page width

Using the Filter Variable

Reference this filter using {{filter_id}}. The value returned depends on where you use it.
ContextDefault PropertyNo SelectionResult
Inline SQL query.filtertruecategory = 'Electronics' AND total_sales > 1000
where attribute.filtertruecategory = 'Electronics' AND total_sales > 1000
Text / Markdown.filtertruecategory = 'Electronics' AND total_sales > 1000

Available Properties

You can also access specific properties using {{filter_id.property}}:

.filter

Returns a complete SQL filter expression combining all active filter conditions. Returns true when no filters are active.
{% table_filter id="my_filter" data="demo_daily_orders" /%}

```sql filtered_orders
select * from demo_daily_orders
where {{my_filter}}
```
Example value: category = 'Electronics' AND total_sales > 1000