Select Page

One of the most concise ways in Tableau to visualize data trends quickly within a small space is to use the Sparkline charts. However, because of the small size of the chart, adding important point indicators such as maximum/minimum points can enhance the readability and help the users understand the context of the visualization. In this post, we will discuss the process of creating sparkline charts in Tableau with minimum and maximum indicators. The inbuilt sample superstore dataset will be used for the demonstration in this blog.

Step 1: Create the line chart of interest.

Drag the dimension field of interest onto the Columns shelf and the measure field onto the Rows shelf. In this example, let us find the average profit for each year. The field for the Columns shelf is the “Order date” Year (continuous/green), and the field for the Rows shelf is the average profit.

Step 2: Create the point indicators.

This step may vary depending on the types of indicators of interest, but in most cases, this step requires the creation of a calculated field to find the point of interest. In this example, let us create points on the maximum and minimum of the average profit across all years. To do so; Create a calculated field with this function;

The logic of the function above reads as follows: If the average profit of that particular point is equal to the average profit across all points in this line chart, then fetch that average profit number, otherwise return nothing. We can duplicate this calculated field to create a minimum point by simply right-clicking this newly created “Maximum Point” field located in the datapane and by selecting duplicate. Then edit the title of this field to “Minimum Point”, and replace the WINDOW_MAX with the WINDOW_MIN.

Step 3: Add the point indicators to the line chart.

To do this, we need to add these indicators as charts that only show a maximum point and a minimum point. Drag the “Maximum Point” to the right of the AVG(Profit) in the Column shelf (Shown in purple in the image below). Add the “Minimum Point” to the “Maximum Point” chart by dragging the “Minimum Point” field to the “Maximum Point” axis to stack these charts together (Shown in red).

Step 4: Stack all the charts together.

Right-click on the newly created “value” axis that was previously the “Maximum Point” axis, then select “dual axis”, then right-click on the average profit axis and select “synchronize axis”. This would stack the charts together.

Step 5: Formatting.

Now for the finishing touch, we want to enlarge the point indicators to make it visible and label these points with the numbers. First, go to the marks card, and select “Measure Values”, then on the dropdown menu, change the chart type to “circle”. Select the “Size” option and increase the size of the points as desired. Finally, on the “Label” option, select “Show mark labels”. We can then further remove all other formatting (such as gridlines and column divider) in the “Format” menu at the top of the tableau window. And this is the final product!

Sparkline chart with indicators is a powerful and concise way to represent data trends and patterns. By following the step-by-step guide in this post, you can create engaging sparkline visualizations that effectively communicate data insights, especially if placed beside a KPI (Key performance index) card, which will be discussed in my next blog! I hope this helps, and happy vizzing!