How to keep a filter on for only one of the dual axes and show percentage for bar chart?

3.3K    Asked by AlastairMcDade in Tableau , Asked on Dec 10, 2019
Answered by Asutosh Jha

Ideally when I add filter it impacts both the axis in dual chart. How to keep it for only one axis

There is no direct option to filter only one axis in the dual-axis graph. But we have alternatives available which can help you achieve this job.


To do that, let's create a calculated field like below-


Now drag the region to the column shelf and then number of records as well as created LOD to the rows shelf. Make LOD as dual-axis and format. Now use category in filter and this will be only applied to the LOD and not to number of records.





Your Answer

Answer (1)

To achieve this in a data visualization tool like Tableau, where you have a dual-axis chart, and you want to keep a filter applied only to one of the axes and display percentages for a bar chart, follow these steps:

Step 1: Create the Dual-Axis Chart

Create the initial chart:

Drag the measure you want to the Rows shelf.

Drag the dimension you want to the Columns shelf.

Create a dual-axis chart:

Drag another measure to the Rows shelf, creating a second axis.

Right-click on the second measure's axis and select "Dual Axis".

Synchronize axes (if necessary):

Right-click on the secondary axis and select "Synchronize Axis".

Step 2: Apply Filter to Only One Axis

Create a calculated field to separate the data for the axis you want to filter:

For example, if you want to filter only the first measure, create a calculated field like this:

  IF [Filter Dimension] = 'Value You Want to Filter' THEN [Measure 1] ELSE NULL END

Use the calculated field for one of the axes:

  • Replace the original measure on the first axis with the calculated field you created.
  • This will ensure the filter only affects the first axis.




8 Months

Interviews

Parent Categories