A clear and concise description of what the bug is.

How to reproduce the bug

on superset 3.0.0

dashboard below before using cross filters

1

dashboard below after using cross filters on blue bar chart

2

same dashboard but using cross filters on the pie chart

4

same dashboard but using dimensions on bar chart

7

Expected results

cross filters work with bar chart without the need of dimensions

Actual results

cross filters on bar chart only work when using dimensions

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

(please complete the following information):

  • browser type and version:
  • superset version: superset version
  • python version: python --version
  • node.js version: node -v
  • any feature flags active:

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • [ ] I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • [ ] I have reproduced the issue with at least the latest released version of superset.
  • [ ] I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

Add any other context about the problem here.

Comment From: sfirke

Interesting, people have reported cross filters not working for bar chart but I hadn't seen anyone point out it was dimension-specific. Thanks for the bug report.

Comment From: WibowoS26

@sfirke yes, because you can't reuse same column for metrics and dimensions on bar chart you need to add another column to be used in dimensions

Comment From: mtrentz

Running into the same problem (3.0) and also noticed it's dimension specific.

It seems that it tries to filter by the metric of the bar chart. When I click in one of the bars and hover over the filter applied in other charts it shows like this:

Apache Superset Bar chart does not emit cross-filter if dimension is not set

In contrast, doing it instead with a pie chart it shows on hover that is being filter by the correct dimension (name of salesperson in this case)

Screenshot 2023-11-16 at 08 51 28

Comment From: sfirke

Someone gave a good description of the bug in Slack, with videos. https://apache-superset.slack.com/archives/C0170U650CQ/p1698853673073119?thread_ts=1684878085.826729&cid=C0170U650CQ

Comment From: 704998200

I have also seen this issue.Is there any update?Or any solution?

Comment From: 704998200

If category axis is not a date,you can set like this.It works for me.

(https://github.com/apache/superset/assets/49085215/7f1cd5c8-2267-45fe-92f3-927ac9898486) (https://github.com/apache/superset/assets/49085215/b404037f-c14f-46e4-a2e5-83343be0c4b5)

Comment From: sfirke

I think the ideal fix would be: bar charts without dimension emit cross-filters as if the series was a dimension. That seems to be the behavior people expect. I have no idea how hard that is to implement.

Comment From: visharavana

@sfirke @WibowoS26 I've noticed this problem with 4.0 as well. Has anything changed recently? or a possible fix? I want only one color, however if I use dimensions, the bar color will show every bar as every color.

Comment From: sfirke

@visharavana this issue persists through 4.0.0. I do not know of a fix or workaround at this time.

Comment From: felipegranado

Hi..

This issue persits on 4.0.1.

Comment From: sfirke

Correct, it persists on the latest version 4.0.2 as well. I expect that if/when this is addressed, the pull request will link back here and close the issue.

Comment From: felipegranado

Hi!

I didn't understand the X-Axis in this graph, this field is mandatory and at the same time it has no Cross-Filter action...

The funniest thing is that the legacy chart does not have this X-Axis and only the Dimensions field (and it is not mandatory).

Even because the X-Axis can become Y-Axis just by changing the format of the graph... so I didn't quite understand the meaning of this field. Dimensions field has everything we need.

I believe that making Dimensions mandatory instead of X-Axis will solve everything!

Thank you in advance for your efforts in resolving the issue. I'm just getting to know the tool now and it's very promising!

PS: And the same thing happens in the line graph!

Comment From: smrodin

If category axis is not a date,you can set like this.It works for me.

(https://github.com/apache/superset/assets/49085215/7f1cd5c8-2267-45fe-92f3-927ac9898486) (https://github.com/apache/superset/assets/49085215/b404037f-c14f-46e4-a2e5-83343be0c4b5)

Thanks, but when doing this, char bars get too narrow

Comment From: felipegranado

If category axis is not a date,you can set like this.It works for me. (https://github.com/apache/superset/assets/49085215/7f1cd5c8-2267-45fe-92f3-927ac9898486) (https://github.com/apache/superset/assets/49085215/b404037f-c14f-46e4-a2e5-83343be0c4b5)

Thanks, but when doing this, char bars get too narrow

Oh.. I forget...

In CUSTOMIZE, you need choose "STACK" option...

Comment From: smrodin

If category axis is not a date,you can set like this.It works for me. (https://github.com/apache/superset/assets/49085215/7f1cd5c8-2267-45fe-92f3-927ac9898486) (https://github.com/apache/superset/assets/49085215/b404037f-c14f-46e4-a2e5-83343be0c4b5)

Thanks, but when doing this, char bars get too narrow

Oh.. I forget...

In CUSTOMIZE, you need choose "STACK" option...

It works like a champ, thanks for your support

Comment From: heiwanokami

I would like this to work so that the cross filter field is the category on x axis not the value (i have categrized data by warehouse zone stock and when i click the zone i expect to filter the neighbour table to be crossfiltered only to the item stored in that zone... curently the cross filter sends the number of pallets in the zone not the zone category... I think this may be common problem with the one reported

Comment From: jiangzihan

Haha....

This issue persits on 4.1.1 too...

Comment From: luibrain

I have the same issue. Cross-Filter only works with dimensions. There are situations where we do not need the date on x-axis.

Comment From: rusackas

Anyone know if #27941 had any impact here?

Comment From: 125m125

Anyone know if #27941 had any impact here?

I just tested it with the 5.0.0rc3 and the behavior has changed a bit, but isn't really fully resolved. It now doesn't allow you to set a cross-filter anymore and says that it can't find a dimension:

Image

If you "force categorical" it allows you to drill down by the x value, but you still can't set a cross-filter:

Image

So in both cases, while it isn't setting a "wrong"/"invalid" cross-filter, it still doesn't allow you to cross-filter by the x value.

Comment From: neeagl

If category axis is not a date,you can set like this.It works for me.

(https://github.com/apache/superset/assets/49085215/7f1cd5c8-2267-45fe-92f3-927ac9898486) (https://github.com/apache/superset/assets/49085215/b404037f-c14f-46e4-a2e5-83343be0c4b5)

This worked for me. Though I need to use 2 bars for each x-axis but when I select "Stacked", it puts them on top of each other. Any workaround?