lightdash.config.yml file or in a schema.yml file for a specific model, and can be referenced in various parts of your Lightdash project.
If you’re new to lightdash.config.yml, check out our getting started guide to learn how to create and set up this file.
What are parameters?
Parameters are variables that you can define once and reference in multiple places throughout your Lightdash project. They allow you to:- Create dynamic filters that users can change at runtime
- Make your SQL more reusable and maintainable
- Allow non-technical users to customize queries without writing SQL
- Save parameter values at the chart and dashboard level
region parameter that users can set to filter data by different geographic regions, a date_range parameter that allows users to select different time periods for analysis, or a min_revenue parameter with numeric values that allows users to set revenue thresholds for analysis.
Parameter Types: Parameters support string, date, and number values. You can use strings (like
"EMEA") or numbers (like 1000) or dates (date parameters will show a calendar picker) as parameter options.Where can you use parameters?
Parameters can be referenced in many places throughout your Lightdash project:- Dimension SQL: Use parameters in the SQL definition of a dimension
- Metric SQL: Use parameters in the SQL definition of a metric
- Table SQL: Use parameters in sql_from and sql_filter definitions
- Table Joins: Use parameters in join conditions
- SQL Runner: Use parameters in the SQL Runner query
- Table Calculations: Use parameters in table calculations
- Additional Dimensions: Use parameters in the SQL definition of an additional dimension
- Custom Dimensions: Use parameters in custom dimension definitions
Parameter types
Parameters in Lightdash support different data types to help you work with various kinds of data. By default, all parameters are treated as strings, but you can convert them to other types as needed.Supported parameter types
Lightdash officially supports the following parameter types:- String (default): Text values
- Number: Numeric values (integers and decimals)
- Date: Date values (date selector is shown in the UI)
Type conversion workarounds
While not officially supported yet, you can work around for other data types via SQL type casting. To convert a parameter to a specific type, use the:: syntax followed by the type name:
The type conversion happens at the SQL level, so the available types depend on your database system (PostgreSQL, BigQuery, Snowflake, etc.). Common types like
integer, numeric, date, timestamp, and boolean are supported across most databases.Boolean conversion
As a workaround, you can use::boolean to convert string values like “true”/“false” to boolean:
Other type conversions
You can use any SQL type conversion that your database supports:How to reference parameters in SQL
Project-level parameters
To reference project-level parameters in SQL, use the following syntax:region:
Model-level parameters
To reference model-level parameters in SQL, you need to include the model name:region from the orders model:
Using the shorter alias
You can also use the shorter aliasld instead of lightdash:
How to define parameters
Parameters can be defined at two different levels in your Lightdash project. For the full list of parameter properties, see Parameters configuration below.Project-level parameters
Project-level parameters are defined in yourlightdash.config.yml file and are available across your entire project. Here’s an example:
Model-level parameters
Model-level parameters are defined within individual model YAML files in your dbt project and are scoped to the model where they are defined. These parameters are defined in themeta.parameters section of your model configuration:
Parameters configuration
Each parameter is a key-value pair: the key is the parameter name (alphanumeric with underscores or hyphens) and the value is an object with the following properties. Project-level and model-level parameters share this schema.
If using
options_from_dimension, the object requires the following properties:
Labeled options
Staticoptions can be plain values or { label, value } objects when the display text should differ from the underlying value — see the status parameter in the project-level example above. Plain string or number arrays remain the simplest form when the label and value are the same. With labeled options, default must match a value, not a label.
Dynamic date defaults
Atype: date parameter accepts a static YYYY-MM-DD default or the keyword today:
today is resolved every time a query runs, so dashboards, scheduled deliveries, and API calls that do not set the parameter always use the current date. The date picker opens pre-filled with today’s date and stays fully editable, so viewers can still pick any other date.
today is evaluated in the project’s query timezone. Projects with intraday data close to midnight should check that this timezone matches the one their metrics are reported in.Examples of using parameters
Let’s look at some examples of how to use parameters in different parts of your Lightdash project.In dimension SQL
You can reference parameters in the SQL definition of a dimension:filtered_revenue dimension will only show revenue for the regions selected in the region parameter.
In numeric dimension SQL
You can reference numeric parameters directly without casting:high_value_orders dimension will be true for orders with revenue greater than or equal to the numeric min_revenue parameter value.
In metric SQL
You can reference parameters in the SQL definition of a metric:avg_distance_unit_param metric will return an average of the race distance in miles when the unit parameter is set to Miles and Kilometers when it gets set to Kilometers.
Metric-based parameters
Parameters aren’t just for filtering—they can swap entire metrics. Instead of creating multiple charts for each KPI, use a single parameter to dynamically control which metric is displayed. Users can toggle betweentotal_revenue, won_revenue, deal_count, and win_rate from one dropdown.
selected_kpi metric dynamically returns different values based on the kpi_selector parameter. This allows you to build a single chart that can display multiple KPIs. See this in action on our demo site.
In table joins
You can use parameters in the SQL_ON clause of a table join. This includes both project-level parameters and model-level parameters from the joined table:region parameter.
You can also reference model-level parameters from joined tables:
customer_status defined in the customers model. This allows you to dynamically filter the joined data based on parameters specific to the joined table.
In sql_from for dynamic tables or schemas
Parameters are always rendered as quoted string literals, so you can’t drop a parameter directly into a FROM clause to switch tables or schemas. To dynamically choose a table or schema at query time, use Liquid templating around the parameter reference.
If you don’t care about quoting, you can interpolate the parameter directly into the identifier:
case or if block wrapped in {% raw %} so Lightdash doesn’t try to render the parameter as a string:
In table calculations
You can reference parameters in table calculations:date_range parameter.
In additional dimensions
You can use parameters in custom dimension definitions:date_range parameter.
In SQL Runner
Parameters can also be used in SQL Runner queries:region parameter, by the date selected in the date_range parameter, and by orders with revenue greater than or equal to the numeric min_revenue parameter.
Model parameters from joined tables in dimensions
When working with joined tables, you can reference model-level parameters from the joined table in your dimension definitions:filtered_customer_revenue dimension uses a model-level parameter target_segment from the joined customers model to conditionally show revenue.
Reserved parameters
Lightdash provides built-in reserved parameters that are automatically available in every project. You don’t need to define them inlightdash.config.yml or in a model — they resolve from the current query context at runtime.
Reserved parameters appear in custom SQL autocomplete alongside your own parameters. They are surfaced as System variables in the autocomplete dropdown.


If you define a user parameter with the same name as a reserved parameter, your user parameter wins and shadows the reserved one. Avoid naming user parameters after reserved names unless you intend to override them.
date_zoom
Resolves to the currently selected date zoom granularity, lowercased (for example day, week, month, quarter, year, or a custom granularity name). When no date zoom is selected, the value is an empty string.
Reference it in custom SQL just like any other parameter:
Saving parameter values
Parameter values can be saved at both the chart and dashboard levels.Saving values in charts
When you create a chart using parameters, you can save the specific parameter values with the chart. This means that when someone views the chart, they’ll see the data filtered according to the saved parameter values. To save parameter values with a chart:- Create or edit a chart
- Set the parameter values as desired
- Save the chart
Saving values in dashboards
You can also save parameter values at the dashboard level, which allows you to create dashboards with consistent parameter values across all charts. To save parameter values in a dashboard:- Create or edit a dashboard
- Add charts to the dashboard
- Set the parameter values as desired
- Save the dashboard
Parameters on dashboards
A dashboard shows a control for each parameter that its charts reference, at the top of the dashboard alongside the dashboard filters. On a dashboard with tabs, a control only appears on the tabs whose tiles use it. Changing a control’s value re-runs every tile whose chart references that parameter.One control per parameter
Whether tiles share a control depends on where the parameter is defined:- A project-level parameter has a single name, such as
volume_currency. Every tile whose chart references${lightdash.parameters.volume_currency}shares one control, whichever model the chart is built on. - A model-level parameter is identified by its model name plus its parameter name, such as
orders.volume_currency. Parameters with the same name on different models are separate parameters, and each one gets its own control.
volume_currency parameter, and the dashboard has tiles built on all five, the dashboard shows five volume_currency controls, one per model. Each control only changes the tiles whose charts reference that model’s parameter. Each control shows its parameter’s label, so if the five models use the same label, the controls look identical.
A dashboard parameter control can’t be mapped to parameters from other models, and parameters have no equivalent of a dashboard filter’s Tiles tab: a parameter’s dashboard value applies to every tile whose chart references it. Follow the issues for mapping one control to parameters from several models and choosing which tiles a dashboard parameter applies to for progress.
Sharing one control across models
When a parameter means the same thing on several models, such as a reporting currency or a region, define it once as a project-level parameter inlightdash.config.yml instead of on each model. Then reference it by its project-level name from every model’s SQL:
volume_currency control that drives every tile. Keep model-level parameters for settings that only make sense on one model.
Charts and dashboards store saved values by parameter name, so values saved for orders.volume_currency don’t carry over to volume_currency. After the move, set the value again on any chart or dashboard that saved one, and save it.
How each tile gets its value
For each parameter a tile’s chart references, the tile uses the first of these that is set:- The dashboard value: the value picked in the dashboard’s control, otherwise the value saved with the dashboard
- The parameter’s
default, from its project-level or model-level definition - The value saved with the chart
default therefore applies that default to every tile until the dashboard sets a value, including tiles whose charts were saved with a different value. A parameter without a default lets each tile keep its chart’s saved value until the dashboard sets one.
To see the values a tile ran with, click the parameters icon in the tile header. Each value is labelled from dashboard, from chart, or default.
Viewers can change parameter values without editing the dashboard. Their changes aren’t saved to the dashboard: they’re kept in the dashboard URL, so sharing the link shares the values. Clearing a value returns the control to the dashboard’s saved value, if it has one. To change the saved values, edit the dashboard, set the values, and save it.
Parameters vs dashboard filters
A dashboard filter constrains the values of a field. It adds a condition on that field, and from the filter’sTiles tab you can remove it from a tile or point it at a different field on each tile. A parameter substitutes a value into SQL wherever it is referenced (a dimension, metric, join, or sql_from) and appears as a control on the dashboard for every tile whose chart uses it.
Use a dashboard filter to restrict the rows a field returns. Use a parameter to change the SQL logic itself, such as the currency amounts are shown in, the date grain, or which KPI a metric returns (see metric-based parameters).
Using parameters well
When using parameters:- Use descriptive names: Choose parameter names that clearly indicate their purpose
- Provide default values: Set default values for parameters to ensure queries work even if users don’t set parameter values
- Add descriptions: Include clear descriptions for parameters to help users understand their purpose
- Consider using options_from_dimension: For parameters that should match values in your data, use
options_from_dimensionto dynamically populate options - Consider performance: Be mindful of how parameters affect query performance, especially with large datasets