How to filter a dashboard with a variable

Svg background
Define a dashboard variable

The very first step is to create the dashboard variable. To do that, in the dashboard options tab, enter the variables in the JSON format, for example:

Define dashboard variables
Use this variable in a global static filter

If you want to filter a datasource in all the dashboard widgets using one of the created variables, create a global static filter (still in the dashboard global options tab), then, in the filter value, use the {{myVariableName}} syntax:

Use a global variable in a global static filter
Note that if the variable is not defined, the widgets using this datasource will return an error.
Use dashboard variables in datasource formulas

Dashboard variables are also available to the datasource formulas. A variable can also be retrieved with the syntax: {{myVariableName}}.

Use a dashboard variable in a datasource formula.