I would like to be able to select Min/Max *and* Line Ends. Currently, you can only choose one or the other.
I would also like to be able to combine selections to label min/max and line ends. It's great for time series data to see the range of the data in a single forward glance without looking over to the axis scales for reference.
Matt, for getting label marks for both conditions, how about something like:
IF MIN([Order Date])=TOTAL(MAX([Order Date])) OR MIN([Order Date])=TOTAL(MIN([Order Date])) OR SUM([Sales])=[Max Sales] OR SUM([Sales])=[Min Sales] THEN SUM([Sales]) END
With "Text Label" places on your Text/Label shelf with its Compute using set to "Order Date" (so it applies to all), as performed in the attached.
min_max_and_ends_label.twbx 43.9 KB
Joe, the results of this 'sorcery' appear to be perfect. Could you please explain what's going on in these calculations?
The first calc, "Text Label", is the main one that tests the conditions you specified, First/Last and Max/Min, each conditional statement is testing for if these conditions are meet.
MIN([Order Date])=TOTAL(MAX([Order Date])), the "MIN([Order Date])" on the left is wrapped in a MIN() function to meet the aggregation requirement, "Order Date" is a dimension on the sheet, so "MIN([Order Date])" would be the same as "MAX([Order Date])" and the same as "ATTR([Order Date])". The right side of the equal sign is a custom table calculation that queries the underlying data source for the MAX date within the partition, and in this case the partition is all data that within the line. So if the Order Date for the mark is the Max Order Date for the Line, then it meets the condition to show the label for that mark.
Same thing for the next line, but with MIN instead of Max for the table calculation.
The next two use a helper function for efficiency reasons. Although for simplicity, the lines
OR SUM([Sales])=[Max Sales] OR SUM([Sales])=[Min Sales]
could be replaced with
OR SUM([Sales])=WINDOW_MAX(SUM([Sales])) OR SUM([Sales])=WINDOW_MIN(SUM([Sales]))
and produce the same result, but it would take longer to calculate with many more marks (See Richard's articles at http://www.equinox.co.nz/blog/Lists/Posts/Post.aspx?ID=102 and http://www.clearlyandsimply.com/clearly_and_simply/2011/01/another-look-at-site-catchment-analysis-with-tableau-6-part-3.html for details on the situation).
These are checking if the mark value is equal to the MAX or MIN value in the line. What this means is that if multiple marks are equally at the max/min value, each that meets that condition will get a label. I believe the Label shelf context menu option for this also does the same, so you could have overlapping mark labels, or multiple marks labeled as the min/max.
Does that help, or what else would you like more details on?
Many thanks, Joe. That detailed explanation, along with the links, is perfect!
Thanks Joe, What a great solution. It worked like a charm.
How about if you have multiple measures on the rows shelf? In my case, I have supply, demand, and revenue.
Also, it probably doesn't matter, but supply and demand share a dual, synchronized axis.
You could use multiple mark types, and a different custom table calculation set for each.
The only other thought I would have to make it more efficient is to un-pivot your data before connecting Tableau to it, and that way Tableau sees a single "Value" column, and then you can use your "Measure" dimension for additional partitioning.
Hi . Mcnike,
Depending on your view, you could potentially duplicate the viz and select dual axis (synchronize axis) and choose select on one and highlight on the other? I have had success with this before.