KNOWLEDGE BASE

How to Specify Only Certain Labels to Be Displayed in Bar Charts Created with Multiple Measures


Published: 16 Jan 2024
Last Modified Date: 16 Jan 2024

Question

How do you specify only certain labels to display on a bar in a bar chart created with multiple measures?

For example, in a bar chart as shown below, how can you display the labels of SUM(Profit) and SUM([Sales(Current Year)]) on the bottom and top of the view only, while hiding the value of [Profit(Previous Year)] and [Sales(Previous Year)]?
User-added image

Environment

  • Tableau Desktop

Answer

Please follow along with the following solution using the sample packaged workbook and video found in the Attachments section of this article.

1. Add the target Sales(Current Year) and Profit fields onto Details Marks card.
User-added image

2. Right-click on the Y-axis and select Add Reference Line and add a reference line as demonstrated below.
User-added image
①  Scope: Per Cell
②  Line Value: AGG(Sales(Current Year)) 
③  Maximum
④  Label: Value
⑤  Formatting > Line: None

Click OK to save the changes.
User-added image
3.  Repeat step 2 to add a reference line for Profit as demonstrated below.
User-added image

4. Use the Format menu to adjust the position of labels to be shown on the bottom and top of the bar chart.
*Please refer to the video demo-video.mp4 for detailed steps.

After making the changes the labels appear as shown here:

User-added image
Did this article resolve the issue?