By default Tableau gives you some options to decide when to show the mark label: All, Min/Max, Selected, Highlighted or Line Ends (for the line chart).
What if you want to have different options, such as "Max & Line Start" or "Min & Line Ends"?
To achieve that you need to create a calculated field to be used in the mark label:
IF
<CONDIDITON>
THEN
<VALUE TO SHOW>
END
The <CONDITION> will depends of what you wanna show:
//SHOW MAX VALUE
(WINDOW_MAX(SUM([Sales])) = SUM([Sales]))
//SHOW MIN VALUE
(WINDOW_MIN(SUM([Sales])) = SUM([Sales]))
//SHOW LINE STARTS
FIRST() = 0
//SHOW LINE ENDS
LAST() = 0
You can also mix those conditions.
For instance, you wanna show the Max & Line Starts as we said before:
IF
//SHOW MAX VALUE
(WINDOW_MAX(SUM([Sales])) = SUM([Sales]))
//SHOW LINE STARTS
OR FIRST() = 0
THEN
SUM([Sales])
END
You can also use that logic to color your chart. Just need to change the calculation to boolean.
For instance, you wanna color with orange the Min & Line Ends:
//SHOW MAX VALUE
(WINDOW_MIN(SUM([Sales])) = SUM([Sales]))
//SHOW LINE ENDS
OR LAST() = 0
You may use parameters to add interactivity (click on the image to be directed to Tableau Public):