Dashboard Filter - Variable Apply On
In this page you can see the functioning of variable apply on method available in Dashboard Filters.
Last updated
In this page you can see the functioning of variable apply on method available in Dashboard Filters.
Last updated
Using Variable Filter in Dashboard Filter with Custom SQL
Creating a Dashboard Filter with Variable Filter:
Create Dashboard Filter
In the “Apply On” section, choose "Variable Filter".
Assign Variable Name:
Assign a variable name, for example, {{global_value}}
for Dashboard Filter.
Copy the variable {{global_value}}
for use in your custom SQL query.
Let's say you're building a dashboard where analysts need to quickly filter population data for different countries without modifying the underlying SQL query each time. Here's how the Dashboard Filter would be valuable:
Purpose:
Allows users to dynamically select different countries to view their population data
Eliminates the need to write separate queries for each country
Provides a user-friendly interface for non-technical users
Example Custom SQL Query with Variable Filter:
Custom SQL you write:
Custom SQL added with Variable Filter:
Then the Generated SQL we generate would look like this:
Resulting SQL:
Working:
Initial SQL query gets all country population data
Variable Filter adds a WHERE clause with {{global_value}}
When users select a country from the filter, it automatically updates the query
Results are instantly filtered to show only the selected country's data