Different filters for line and bar within one stack bar combo chart

Hi, I was wondering if there is a way to apply different filters for the lines and bars within a single stacked bar chart?

For example, I have a line representing the total of sales within the company, and bars representing the sales amount by different sales. I want to apply a filter to the bars where it only keeps 3 sales of my interest. But I want the line chart to remain constant to represent the total of sales, which indicates the line does not respond to the filter.

I have been stuck with this question for months. I would appreciate it if anyone could provide me with any actionable ways to achieve it. Note: I do not want to create separate charts for total sales and sales by salesperson. I want these two in a single stacked bar chart. Thanks.

Hello @irinaaaaa and welcome to the Quicksight community!

Filters applied to a visualization or analysis will affect all relevant data so it’s most likely not possible to exclude the Line Field Well for a stacked bar chart combo.

The workaround that comes to mind is that you could creating both a line chart with total sales and then a separate bar chart that has filters applied. Then using the free form layout, layer those charts. However, the visual aspect could get messy as the bar chart filters effect the size of the visualization.

1 Like

You can try to create a calculated field for your total sales like this and use it for your line chart:
Sales Fixed Total =
sumOver(Sales, [{salesperson}], PRE_FILTER)

Then use Sales(Sum) for your bar chart.

In my example below each bar is a year and each colour is an industry.

When I select 3 industries instead of all, my line chart remains the same and only the bars change.

2 Likes

Thank you so much for the speedy response @David_Wong and @duncan. The sumOver function with PRE_FILTER works greatly as what I’m looking for.

Much appreciate your help.

1 Like