Skip to main content
Filters allow you to create dynamic, interactive dashboards that adapt to user selections and time ranges. They work at the dashboard level and automatically inject values into your chart queries, making it easy to explore different data slices without rewriting prompts.

How filters work

Filters are dashboard-level controls that automatically add variables to your chart queries. When you reference entities or time periods in your prompts, Basedash intelligently creates the appropriate filters and injects them into your SQL queries.

Automatic filter creation

Basedash automatically creates appropriate filter types when you use certain language patterns in your prompts:
  • Entity references: “Show me details for a user” → Creates a record filter
  • Time references: “Revenue over time” → Creates date range filters
  • Text searches: “Customers named John” → Creates text filters
  • Numeric thresholds: “Orders over $100” → Creates number filters
  • Boolean conditions: “Only active users” → Creates boolean filters
  • Category selections: “Sales by region” → Creates list filters

Filter types

Basedash supports several filter types:
  • Text: Free-form text input for string matching and search
  • Number: Numeric input for quantities, thresholds, and ranges
  • Boolean: True/false toggle for binary conditions
  • List: Dropdown selection from a predefined set of options
  • Record: Dropdown selection populated from database records
  • SQL: Custom SQL-based filtering for advanced logic

List filters

List filters let you define a static set of options for users to choose from. This is useful when you have a known set of values that don’t come from a database table, such as status categories, regions, or time periods. You can configure whether users can select a single value or multiple values.

Record filters

Record filters automatically populate options from your database tables. When you create a record filter, Basedash queries the table and displays records in a searchable dropdown. This is ideal for entity-level dashboards where users need to select a specific customer, order, or user to view details about.

SQL filters

SQL filters let you write custom SQL to generate the list of options. This gives you full control over the dropdown values, allowing you to join tables, apply conditions, or format display labels. Use SQL filters when the built-in list and record filters don’t provide enough flexibility.

Built-in variables

Basedash provides built-in variables for time-based filtering. When your SQL references these variables, Basedash automatically shows the corresponding controls in the dashboard filter bar.
VariableTypeDescription
start_dateDateStart of the selected date range, formatted as YYYY-MM-DD
end_dateDateEnd of the selected date range, formatted as YYYY-MM-DD
time_intervalStringGrouping interval: HOUR, DAY, WEEK, MONTH, or YEAR

Date range

The date range picker lets users select a time period. When they select a range like “Last 30 days”, Basedash calculates the actual dates and injects them into the start_date and end_date variables. Available options:
  • Last N days: LAST_7_DAYS, LAST_30_DAYS, LAST_60_DAYS, LAST_90_DAYS
  • Last N months: LAST_6_MONTHS, LAST_1_YEAR
  • This period: TODAY, YESTERDAY, THIS_WEEK, THIS_MONTH, THIS_QUARTER, THIS_YEAR
  • All time: ALL_TIME
  • Custom: User-specified start and end dates
For example, if a user selects “Last 30 days” on January 15, 2025:
  • start_date resolves to 2024-12-16
  • end_date resolves to 2025-01-15

Time interval

The time interval selector controls how data is grouped in time-series charts. Charts automatically use this value when grouping by date. Available options: HOUR, DAY, WEEK, MONTH, YEAR

Example usage

SELECT
  DATE_TRUNC('{{time_interval}}', created_at) AS period,
  COUNT(*) AS signups
FROM users
WHERE created_at BETWEEN '{{start_date}}' AND '{{end_date}}'
GROUP BY period
ORDER BY period

Filter configuration options

Multiple values

Enable “Allow multiple values” to let users select multiple options from list and record filters.

Required filters

Mark filters as “Required” to ensure they always have a value before queries execute.

Public dashboard visibility

Filters are hidden by default on public dashboards. To show a filter, edit the filter and enable the “Show on public dashboard” option. Hidden filters still apply their default values to queries—they’re just not visible or editable by viewers. See embedding for more details on filter visibility and security considerations.

Default values

Set default values for filters to provide starting points for user interactions.

Accessing and managing filters

Variables tab in the full page editor

You can view and manage all variables for a dashboard by going to the Variables tab within the full-screen chart editor. This shows variables with their current values and allows you to modify configurations.

Applying filters to other charts

When multiple charts use a variable with the same name, they share a single filter control. Changing the filter value updates all charts that reference that variable, creating cohesive analysis experiences across the dashboard.
To apply an existing filter to another chart, tell the AI to update the chart. For example: “Update this chart to use the same date range as the revenue chart” or “Apply the user filter from the activity chart to this chart.”

Best practices

Use open-ended language

Instead of specific time periods, use open-ended language to leverage filters: Good:
Show me user signups over time
Avoid:
Show me user signups for the last 7 days

Reference other charts

Since Basedash AI understands your entire dashboard, you can reference other charts:
Show me the same data as the revenue chart but for a different time period

Leverage entity context

For entity-level dashboards, use entity-specific language:
Show me this user's order history
Show me this organization's performance metrics