Skip to main content

How to Prevent Cross Filtering in Tableau

Assume we have a dashboard that’s something like the below. I want to be able to filter the line chart by either the map or the bar chart, but not by both at the same time. This is a simple method in restricting how users will be able to access your data without using Tableau Server’s user filters.

Its a very specific use case and a bit tricky for 2 reasons:

1) Single Select only works on 1 sheet whereas I need to select between 2 sheets which host 2 different dimensions – so I end up with unintentional cross filtering.

2) Adding the individual dimensions into dashboard actions will ask for a particular combination of the two, whereas I want the default “all” option to persist when the alternative action is chosen. i.e. for 1 state, show me all sales for all categories OR for 1 category, show me the sales for 1 state.

The interesting part of this trick is we’re using 2 ways to “clear” a sheet

– using a custom value list in filters to not show values in the sheet using the exclude function.

– using dashboard actions to exclude values when no values are selected.

Using these 2 princples (and 2 sheets) allow us to only filter 1 way because they are sourced from different sheets. Effectively only 1 of the sheets will provide the actual filtering but the other sheet provides the state breakdowns when categories are chosen

How do we do this?

There are 2 key mechanisms at work with this

– You’ll need 2 action filters and 2 maps. Each map will “collapse” but under 2 different conditions:

Part 1: Duplicating the Map into an Original Sheet and Secondary Sheet

Simply right click and duplicate the tab so you end up with 2 maps. Make sure you keep track of which one is the original and the secondary.

Part 2:  Setting the Original Map to Collapse When there’s Only 1 Dimension in the View

1) The original map will collapse when it detects there is only 1 category dimension in the view. Something like this in filters.

Convert the pill into a discrete measure….

Then drag it filters and configure it with a custom value list of “1”, excluding this value. This is because we are asking Tableau “clear” the sheet when there’s only 1 category in the view.

Part 2: Setting up Dashboard Actions.

We’ll need 2 dashboard actions – the first is to set the filtering action and the second is for the secondary map to “clear” when nothing is selected.

Setting the filter to act as per usual:

Setting the filter to collapse the secondary map (“New Map”)  when nothing is selected. Notice that the line chart is not selected here since we want the line to continue to show.

Essentially, you won’t want the new sheet to show until 1 category is selected. But based on what we did in Step 2, the original sheet will collapse when 1 category IS selected. A bit of a switcheroo!

At this point, you can put the maps into a container and with a bit of adjustment, the sheets should be show/hiding with the functionality above.

Hope that helps- let me know if you have any questions.

Leave a Reply

Your email address will not be published. Required fields are marked *