Sharon left a message in my last post on Labeling Trellis Chart Anywhere asking whether we can have one label on the left and another on the right per trellis chart cell in Tableau. Yes we can. Below we will show how to place multiple labels within a trellis cell.

Label's Horizontal Positions 

Assume our data is a time series and the horizontal dimension is Date. Then here are a few examples.

  • Label on the left is defined by First()=0.
  • Label on the right is defined by Last()=0.
  • Label in the center is defined by Index()=Int(Size()/2)

Here are some of the labels we use in the above trellis chart:

In the label editor, we compose the labels. Both the left label and right labels are placed on the first row. Depending on horizontal positions, some labels are on when the others are off. The 2nd row has only labels on the right. The alignment is set to be center-aligned.

How many labels can we place within a trellis cell? Probably more than we need. We can add as many labels as there are dates or months. 

Label's Vertical Positions

In the previous trellis chart, both labels have equal height at the top. The height of both is defined by the following function:
Note that the vertical axis is fixed from 0 to 1. Since we know there are only two labels and their exact positions, we could alternatively write Label Height 1 as
  • If First()=0 or Last()=0 Then 1 End
The horizontal grid is defined already by Date. We will show how to use Label Height 2 to define the vertical positions of labels. 

In the above chart, we have 2 labels per trellis cell. We write Label Height 2 as follows:

Note that the height for the labels in the center is -0.2. The vertical axis is fixed between -0.2 to 1.

Conclusion

We can place multiple labels per trellis cell. And again we can label them anywhere. 

Feel free to download the demo workbook. If you have questions, leave comments or contact me at twitter @aleksoft.
0

Add a comment

[Forward: I asked ChatGPT o1-mini who then wrote this. Hope it helps. All the credit and the blame go to ChatGPT.

I went over the plan and it looked decent. Whether it can be done in 30 days or not, it depends on the person and the time he spends on it.
Just came back from Tableau Conference 2022 at Las Vegas. What an exciting event! The most exciting thing is reuniting with old friends and meeting with the datafam people known online for years.

Attended first time the Tableau Visionary summit.
A little enhancement in the formula editor can make a big difference for whose who create formula all the time in Tableau. Here are my wishes for a future editor. 

Highlighting Syntax Words

Currently a formula in Tableau can look plain and a bit uninspiring.
Blog Archive
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.