KNOWLEDGE BASE

Filtering Single Axis of Dual-Axis Chart


Published: 12 Nov 2014
Last Modified Date: 01 Nov 2019

Issue

When creating a dual-axis graph, the filter affects both axes. There is no option in the user interface to select which axis the filter affects. 

Environment

Tableau Desktop

Resolution

Depending on the view, the best option will vary. See Additional Information below for more details on when each solution may be a better option when. The workbook downloadable from the right-hand pane provides examples for each option with detailed instructions.


Option 1: Create a calculation that ignores filters

Create a calculation that ignores filters to use as one of the axes. See Creating a Calculation that Ignores Filters for directions either using the level of detail (LOD) expression FIXED, or a parameter.

Note: When using a parameter, each axis may have one NULL mark. These marks cannot be filtered out or hidden because the NULL mark on one axis is associated with all of the non-NULL marks on the other axis.
 

Option 2: Use data blending

Blend in a second copy of the original data source, and then use the measure(s) to be filtered from the secondary data source as well as the filter field(s).
  1. Right-click on the data source and select Duplicate.
  2. Link the data sources are all dimensions in the view except the dimension you want to use as a filter.
  3. Create the dual axis from the secondary data source.
  4. Create a filter using the dimension from secondary data source. 


Option 3: Use a self-union

Unioning the data to itself will duplicate the data, which means the filter can be modified to show the end user which axis they are filtering.
  1. Navigate to the Data Source tab
  2. Drag a second copy of any table containing a filter field over the original table and drop on the "Drag table to union" text
  3. Replace the axis fields with calculations that define the axes as values from only one table in the union, such as:

    IF [Table Name] = "{table name}"
    THEN [Axis Measure]
    END
  4. Replace the filter field(s) with a calculation that adds an axis name, such as:

    IF [Table Name] = "{table name}"
    THEN "Axis 1 name, "
    ELSE "Axis 2 name, "
    END
    + [Filter Field]

Option 4: Overlay two scatter plots

When both the Columns shelf and the Rows shelf contain dual axised measures then the view is 4 overlaid scatter plots, one for each combination of the 2 measures on each shelf. In order to show 2 of the 4 scatter plots overlaid, do the following:
  1. Create the desired scatter plots in separate worksheets
  2. Add both worksheets to a dashboard with one floating on top of the other. See Tile or float dashboard items
  3. Set the background of the top worksheet to be transparent. See Make worksheet backgrounds transparent

Cause

Fields on the Filters shelf apply to the entire view

Additional Information

  • For map views, use: option 1 with a parameter. The original latitude and longitude fields must remain in the view, and any fields on the Marks cards that affect the appearance of the view must be replaced with calculated fields that filter the data. See the worksheet "Opt 1b: Parameter" in the workbook downloadable from the right-hand pane for an example.
  • Option 1 with a FIXED calculation may hit an issue when all records of a category are filtered out, then the category will be filtered out as well. If the category needs to always show, then use option 1 with a parameter or option 3.

To voice your support for the inclusion of this enhancement in a future product release, add your vote to the following Community Idea: Filtering a single axis on a dual axis map


Discuss this article... Feedback Forum
Did this article resolve the issue?