Robert new in 8.0(.3?) you can now use sets in a calculated field (thanks T this is great news!!!) So all you need to do is create a set of the cities you want to label, then create a calculated field like this:
IF [City Labels] THEN [Cites] END
That first field would be the set. It returns a boolean result, so the cities will be show if they are 'in' the set. (See attached.) You can use this for all the cities you want to always see and then use a dual axis to show the rest of the labels. The other sheet shows how to show labels based on a value like SUM([Population]).
Hope this helps,
Show Labels.twbx.zip 973.4 KB
I think I can make that work pretty well. I can probably use that concept to make it more "dynamic", choosing which set(s) to show depending on other fields/parameters. I'd like to see Tableau automatically give precedence to showing mark labels based on sort order, but that will probably have to wait.
1 of 1 people found this helpful
I have accidentally discovered a "hack" of sorts that shows the labels for the "top" values, sized according to the selected measure. Here's what I did:
- Set the mark based on a defined latitude/longitude, NOT the lat/long generated by tableau from other geographic roles.
- Change the mark type to "filled map"
- Add desired labels
- Size according to some measure
Here you can see that the label for Denver, just South of Fort Collins, is hidden. When zoomed in, it appears:
This will cause the labels to show directly on top of the marks themselves (circles by default). To correct this, do one of the following:
- Change the transparency and borders of the mark to make it "disappear" like so:
- Edit the label text to have a blank space on a line below the label, allowing room for the mark itself. (Notice the blue highlighted space below the <city> label).
In all, the result showed only the labels for "top" values when zoomed out, then showed the more detailed labels when zooming in - all without dealing with sets, double axis maps, etc.
Robert, screenshot please. Thx.
It's now updated with screenshots, as requested.