Chapter 78. How to Automatically Highlight the Latest Trends
This tutorial illustrates how to add a highlighter to the most recent data point on a line graph. You also can dynamically color this highlighter to communicate that the latest trend was either positive or negative. This technique provides several benefits, such as orienting your end users, communicating positive and negative performance changes at a glance, and enhancing the dashboard design.
To highlight the latest trend, let’s use the trick from Chapter 63 in Practical Tableau (O’Reilly, 2018), “How to Highlight a Dimension.” Even though we can add reference lines to dates, we will need to get a little hackier to produce the effect we’re looking for. In this exercise, we combine this trick with a calculated field to automatically turn on the highlighter for the most recent month in our analysis and color it to communicate a positive or negative change.
First, I’m going to lay the foundation for the chart by making a Sales by continuous Month line graph from the Sample – Superstore dataset:


Next, let’s create a calculated field that will eventually draw a bar for the most recent month being visualized. Here’s the formula:
IF ATTR(DATETRUNC( 'month',[Order Date])) = WINDOW_MAX(ATTR(DATETRUNC( 'month',[Order Date]))) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access