Parameters are useful in allowing displayed results to be filtered, without actually modifying the SQL query. This is especially useful when you have internal SQL queries written, and only need to filter by certain parameters each time you run the query, and where you want to specify conditions for your filters (i.e., all results greater than or less than a certain value; all data created after or prior to a certain date; all data filtered to a specific field).

As an example, instead of specifying “color is green” inside the SQL query (directly modifying the SQL code), you can change the parameter to specify “green.”

If you don’t have parameters, in order to specify a color, you would require a WHERE clause to be changed each time (modifying the actual code - if you lack WRITE access, you will simply be unable to modify the actual SQL query):

However, with a parameter, you can filter for the value for the parameter you want to change. This can be modified with READ access, as you are not directly accessing the code.

At the bottom of the page, you will see an actual “executed query” - which will show you the SQL query that was executed after the parameters were selected.

How to Parameterize Your Query


In general, you will replace a specific value in your SQL query with a bracketed text - “{{parameter}}” - which is your parameter. Once the parameter is filled in, your SQL query will be existed with the parameter and filter your charts / tables. If the field you are parameterizing is not a “text” field (i.e., integer, or date-type), you will need an additional step. See below.

Parameterizing a Text field 

WHERE color = ‘green’

is replaced by 

WHERE color = {{color}}

Parameterizing a number field

LIMIT 3

is replaced by 

LIMIT {{result_limit}}


Then, you must click “Run Query” for the parameter to show up in the parameters block.

To configure the type of data from “Text” to “Number,” click on the name of the parameter (NOT the empty space beside it - which will be used to specify your parameter).

From there, modify the data type to “Number” and click “Update.”

Filtering by date

where created_after >= '2019-01-01'::date

is replaced by

where created_after >= {{created_date}}


Once again, you would click on the parameter and modify the data type to “Date” prior to assigning a value to that parameter.


Did this answer your question?