GitHub user dosubot[bot] added a comment to the discussion: Configuring two 
metrics causes SQL statements to appear in the echart legend configuration, 
while configuring one metric works normally.

<!-- Answer -->
This is a known limitation in Superset's cross-filtering logic for charts with 
multiple metrics. When you use more than one metric, the legend labels are 
built by combining the metric label (or SQL expression) with the dimension 
value. During cross-filtering, Superset tries to map the clicked legend label 
back to the dimension value using a labelMap, but in multi-metric scenarios, 
this mapping includes the metric label as part of the filter value. As a 
result, the generated SQL filter ends up using metric labels or SQL expressions 
instead of just the dimension values, which leads to the confusing SQL you 
observed ([code 
reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx)).

Currently, there isn't a built-in workaround to force Superset to filter only 
by dimension values in this scenario. The safest options are to use only one 
metric per chart when cross-filtering is needed, or to avoid relying on 
cross-filtering for charts with multiple metrics. This limitation affects all 
eCharts-based visualizations with multi-metric groupby setups.

If you need cross-filtering with multiple metrics, you may want to monitor 
future Superset releases for improvements in this area, as the frontend and 
backend would need changes to better separate metric and dimension values in 
legend and filter logic.


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/6c148e9f-411e-4b11-ad63-63441dfb32cd?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/6c148e9f-411e-4b11-ad63-63441dfb32cd?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/6c148e9f-411e-4b11-ad63-63441dfb32cd?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/6c148e9f-411e-4b11-ad63-63441dfb32cd?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/6c148e9f-411e-4b11-ad63-63441dfb32cd?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/6c148e9f-411e-4b11-ad63-63441dfb32cd?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/6c148e9f-411e-4b11-ad63-63441dfb32cd?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&
 nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/34689)

GitHub link: 
https://github.com/apache/superset/discussions/34689#discussioncomment-14101769

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to