Issue: Dashboard Filters Not Passing Through Query Builder Questions to SQL Questions with Variables
What we're trying to achieve:
We have a dashboard with filters (tenant, start_date, end_date) that need to filter a Query Builder question that's based on a SQL question.
Our setup:
-
Dashboard has 3 filter parameters:
tenant,start_date,end_date -
Question A (Query Builder) - uses Question B as its data source, displayed as a Pivot Table
-
Question B (SQL/Native Query) - contains variables
{{tenant}},{{start_date}},{{end_date}}
Why this architecture:
We need Question A to be a Query Builder question because we're rendering it as a Pivot Table. Writing the entire query as a native SQL question and rendering it as a pivot table is extremely slow (unusable performance). However, the underlying SQL query in Question B executes very quickly. This two-layer approach (Query Builder pivot on top of fast SQL query) gives us acceptable performance - except the dashboard filters don't work.
The problem:
When we connect dashboard filters to Question A, the filters don't pass through to the variables in Question B. The SQL variables remain unfiltered.
What we've tried:
-
Dashboard filters work if Question A is also a SQL question with variables
-
But pivot table rendering on a SQL question is incredibly slow (unacceptable performance)
-
When Question A is a Query Builder question (fast pivot rendering), there's no way to connect dashboard filters to the SQL variables in its source Question B
Related GitHub issue:
This appears to be the same limitation described in GitHub issue #6449 (480+ upvotes): "Field filter from nested query"
https://github.com/metabase/metabase/issues/6449
From the discussion, it seems that "variables are currently not available to parent questions" and implementing pass-through would require addressing permission levels and other complexities.
Question for support:
Is there a way to pass dashboard filters through a Query Builder question to SQL variables in its source SQL question? Or is this still a known limitation as described in issue #6449?
If this is not supported, what would you recommend as the best workaround for our use case where we need both pivot table visualization and dashboard filters with good performance?
Environment:
-
Metabase version: 0.57.3
-
Database: SQL Server