Welcome, let’s discuss how to make a sparkline chart in Tableau desktop.

Make a line chart and build a straightforward calculation, then you will want to throw a celebration. If you want the “definition of sparkline” – right click and format to your hearts content, remove everything, add the line chart next to something relative. Boom. done.

If you want to add a little DOT on the end of it… last()=0

By the end of this blog, you will understand how to build a sparkline chart, add a dot to the end of the line, and we will show you screenshots to guide you through each step.

For the advanced users – we give the steps without screenshots below.

For new Tableau users – we break it down step by step. If you need help with this visualization, we would be happy to help you build a sparkline chart in Tableau, contact our Tableau consulting team.

6 steps to make a sparkline chart in Tableau Desktop.

  1. open tableau desktop
  2. create a line chart
  3. build a calculation using if last()=0 then MEASURE end
  4. dual axis the calculation
  5. sync your axis
  6. hide the indicator

Here are the corresponding screenshots to help you see what’s happening.

Building sparklines in Tableau Desktop are quick and easy.

#1 Building a Sparkline chart – Open Tableau Desktop.

If you don’t already have Tableau Desktop, you should download Tableau Desktop, and install Tableau Desktop.

Once you have Tableau desktop activated and running – open any data set. We use Super Store Subset for our tutorial example and want to visualize the running average of profits.

We like using running average to smooth out the lines and give a clear picture of what’s happening per Category.

#2 Building a Sparkline chart – Make a line chart.

Usually, we would drag this part of the tutorial out, but if you’ve made it this far, you already know to double click your measure, change the marks to a line chart, and have a date on the other axis.

If you need more assistance building a line chart, check out Tableau’s extensive Online Help.

#3 Building a Sparkline chart – Build a calculation.

We’ve seen a slew of scary looking calculations over the years – especially when it comes to sparklines.

You don’t need anything complex for this portion of the work.

if last()=0

//that’s all folks.

You can drag and drop any table calculation you’ve generated into a calculation and be done with it! Here’s what our running average calculation looks like the screenshot below.

optimized sparkline calculation in a tableau calculation alt text
Understanding Tableau Calculations is the first step to offering quality user experiences.

For the sake of the demo, let’s call your sparkline calculation, spark.

Drag this next to your measure value – that is your current line chart in Tableau.

#4 Building a Sparkline chart – Dual axis your measure with your spark calc.

Dual axis your measures.

Dual axis your measure with your sparkline calculation.

  1. right click your measure
  2. click dual axis

#5 Building a Sparkline chart – Synchronize axis.

Step 5 – synchronize axis to ensure your upcoming sparkline chart is on point on your line chart.

If you don’t see your header, right click on the measure and show header.

Click on Synchronize Axis, and you probably see the light at this point.

To ensure your sparkline circle lines up with your line - synchronize the axis.
To ensure your sparkline circle lines up with your line – synchronize the axis.

#6 Building a Sparkline chart – Hide Indicator.

You’re nearly completely done! There’s an indicator showing your ‘lack of an else’ in your if statement. Avoiding the ELSE is essentially fewer computations for your computer and Tableau to do. Leaving off else lets us avoid bothering with writing extra code too.

if last()=0
//ELSE 0 — not necessary

And because there’s a clear void in the data, the indicator will appear – we didn’t break anything, the product is working as intended!

Steps to remove that indicator are very quick and painless.

  1. Right-click Hide indicator
  2. Left click Hide indicator

Creating a Sparkline chart in Tableau Desktop Conclusion.

There are 9,370 results on Google for Sparkline Chart Tableau – everyone in the top ten has a popup, forced workbook download, or forced youtube video. We hope that offering you a simple calculation makes the user experience enjoyable!

A screenshot of multiple sparkline charts in Tableau Desktop.
A screenshot of multiple sparkline charts in Tableau Desktop.

We offer advanced content on the Tableau Community too.

Like; How to write Fast Calculations in Tableau Desktop, How to count wins in Tableau desktop.

We offer fun community challengesSolutions to many of many using basic SQL.

Some call it a solution to dynamic parameters – which is the most requested product feature!

Also, we spend a good deal of time offering product feedback. We know the product and love helping the community forum with all kinds of challenging use cases.

Do you build sparklines more efficiently than this method? We would love to update our calculation to offer a more efficient calculation.