Bug description
I'm working with three separate datasets, each built using Jinja templating to support dynamic filtering. These datasets are used to power three different charts in a dashboard. All charts share common filter fields (e.g., start_date, Zone, Circle, etc.), and I’ve configured native filters to apply across all charts.
Each dataset uses Jinja to apply filters like this:
SQL query is something like this in all 3 datasets.
WHERE 1=1 {% if filter_values('Zone') %} AND "Zone" IN {{ filter_values('Zone') | where_in }} {% endif %}
The charts display correct data when filters are applied. However, when I use Drill to Detail or Drill by on any chart, the resulting detail view shows zero records, even though the chart clearly shows data for the selected value.
Expected Behavior Drill to Detail should return the filtered rows from the dataset that match the clicked chart element (e.g., Circle = C1, type_of_node = A).
Actual Behavior Drill to Detail and Drill by return no rows, even though the chart shows non-zero values. This happens consistently across all three charts.
Notes 1. All datasets use Jinja templating for dynamic filters.
-
All charts are built from separate datasets, but they share common column names and filter logic.
-
Native filters are scoped correctly to all charts.
-
The issue seems to be with how Superset applies drill filters to Jinja-based queries across multiple datasets.
Screenshots/recordings
No response
Superset version
4.1.3
Python version
3.9
Node version
16
Browser
Chrome
Additional context
Checklist
- [ ] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Comment From: dosubot[bot]
Hi @ShivamYadav0! I'm Dosu and I’m helping the superset team.
This is a known architectural limitation in Superset 4.1.3: when you use Drill to Detail or Drill by, the drill query only includes chart-level and drill-triggered filters, but does not merge the full dashboard/native filter context. As a result, Jinja-templated datasets that rely on filter_values()
for all filters may receive incomplete filter values during drill actions, leading to zero-row results—even when the parent chart shows data for the selected value. This matches your experience and is not specific to your configuration—it's a gap in how drill queries are constructed versus main chart queries (source).
Recent fixes (after 4.1.3) have addressed some related issues, such as ensuring that drill filters use the original column names instead of verbose labels, which can resolve cases where Drill to Detail returns all or no rows due to filter mismatches (source). However, the core issue—drill queries not merging dashboard/native filters for Jinja-based datasets—remains in 4.1.3.
Recommended workarounds are to avoid relying on Jinja templating for dynamic filtering in chart queries. Instead, use virtual datasets, SQL CASE WHEN
logic, or custom SQL expressions for dynamic behavior (source). If you must use Jinja, ensure your queries have sensible defaults when filters are missing, but be aware this won't fully resolve the drill limitation.
Upgrading to a newer Superset version may help with some filter propagation issues, but the architectural gap with Jinja and drill actions is still present as of the latest releases.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
Comment From: ShivamYadav0
@dosu are there any similar PR or issues?
Comment From: dosubot[bot]
Yes, there are several highly relevant issues and PRs in the Superset repository that match your scenario:
- Issue #33773 describes the same bug: Drill to Detail and Drill by do not work properly on charts powered by Jinja templating because drill queries lack the full dashboard/global filter context, causing Jinja SQL to render with missing values. The suggested workaround is to make your Jinja SQL more robust with if/else blocks, but this doesn't fully solve the context propagation problem.
- PRs #34694 and #34620 fix related issues where Drill to Detail returned all or no rows due to filter column name mismatches, by mapping axis label filters to original column names before executing the drill query. These help with filter propagation but do not address the Jinja context gap.
- PR #34319 enabled Drill to Detail and Drill By in embedded mode and with DASHBOARD_RBAC, but does not address Jinja templating or filter propagation in drill queries.
The core architectural limitation—drill queries not merging dashboard/native filter context for Jinja-based datasets—remains as of the latest releases. You can track the above issue and PRs for updates or further discussion.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
Comment From: sadpandajoe
@ShivamYadav0 can you try on 5.0.0 or 6.0.0rc2 to see if you can repro these same issues? 4.1.X probably won't be supported soon so we're not actively fixing issues on that branch.
Comment From: rusackas
Yep, let's check on 5/6/master
and see if it got fixed anywhere along the way.