This is a little tip that started out with a “Tableau doesn’t do that” and then an “Ooh…it does…that’s so cool!” Here’s the problem: In a single measure table, I want the name of the measure column as a header. In this worksheet using the Coffee Chain data I want “Sales” to be on top of the Sales column:
Now there are a bunch of ways to work around this…if you really want to read a comprehensive list check out the gory details, but there’s a way that tops them all that I learned thanks to Alberto Bertollino. in the aforementioned thread. From the view above (that took two clicks to build), do one (ONE!) more click & drag operation to drop Measure Values over the column and voila!:
Alternatively, if you like double-clicking, that works too!
As Steve Jobs used to say, “Boom.”
Over the last four years this tip would have saved me at least a couple of hours of doing things like creating tables with all discretes and then resizing columns and twiddling with formatting. Multiply that times thousands of Tableau users and we’re talking person-years.
Got another time-saving tip? Share it in the comments below!
Hey, I just learned this a month or so ago too!
Here’s another one I just recently learned, Jonathan — to add Row, Column, and Subtotals, use the Analytics pane and instead of placing the “Totals” object on one of those options, just pull it onto the Crosstab.
BOOM — all totals/subtotals added in one Drag ‘n Drop!
Finally. Thanks JD and Alberto. I’ll never have to waste another moment on this.
You’re welcome, Ken!
Joe Mako showed me this technique (as nearly as I can remember it) quite a while ago, and I’ve happily taken advantage of it since.
The interesting part: why doesn’t Tableau do this automatically?
Hi Chris, This is one of those places where I imagine the Tableau dev had a notion about how Tableau would be used and their imagination was not accurate.
Hi Jonathan,
This is great, thanks! And I would ask, are there any performance implications with using Measure Names / Measure Values in this way ?
One method folks will commonly use to approach this problem is to create a new calculated field with the “label” defined as a simple string constant in their calculation.
Well, an interesting performance facet of that approach is that the string constant is a row level calc. Which means: if your data set contains a billion records, then you’re repeating that “label string” a billion times.
Once the ad-hoc calculations became available in v9, and until this method came along, my own fav approach was to create a multi-line ad-hoc calculation by double-clicking on the pill I wanted to label (where the first line is the label, commented out by //).
This approach is described as #9 and #10 by Joshua Milligan here:
10 Ad-Hoc Calculation tricks you didn’t know in Tableau 9
So, I love it 🙂 So much easier! And I’d be curious to understand which of the approaches will perform better (and why 🙂
Thanks!
Keith Helfrich | Twitter
Red Headed Step Data
Hi Keith,
Good question! I just did some testing using Tableau 9.1.1 on my MBP on a 1M row extract with numbers going from 1 to 1M. Using Measure Values the query took 0.5 sec on average. Using an ad hoc calc with the formula //Sum of ID[shift-enter]”Sum of ID” and *not* optimizing or refreshing the extract (so the calc would need to be computed for every record) the query took 3 sec on average (3 tests each). So that’s 6x slower for a non-materialized field in the query portion. The other major categories (computing layout and sorting) had negligible differences in time, so the net difference in this case was about a 25% speed improvement. That’s just in an extract, other tests would be need for live connections.
OK! So, good to know. It looks like the use of using ad-hoc comments is quite slow. So I’ll avoid using that one in production. Makes sense now, because that processing would be done for every row in the data set.
It also sounds like ‘optimizing the extract’ will materialize that ad-hoc //”label”, in much the same way that the [measure name] is already materialized from the start.
So, it’s both easier and more straight forward to use the [measure names] / [measure values] approach. One thing I’ve never liked about those ad-hoc comments is that they hide what the pill is doing from view, making it much more difficult for the person who comes behind you to figure it out.
Thanks!
Keith Helfrich | Twitter
Red Headed Step Data
I’m with you on the ad hoc comments hiding details. I’m not sure if ad hoc pills are materialized in extracts, I’ll have to find out.
Pingback: Getting rid of “Year of” for Dates | Drawing with Numbers
Just started learning Tableau and this was super helpful! I especially liked the movie clip.
Thanks!