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.
- open tableau desktop
- create a line chart
- build a calculation using if last()=0 then MEASURE end
- dual axis the calculation
- sync your axis
- hide the indicator
Here are the corresponding screenshots to help you see what’s happening.
#1 Building a Sparkline chart – Open 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.
//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.
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 measure with your sparkline calculation.
- right click your measure
- 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.
#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.
//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.
- Right-click Hide indicator
- 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!
We offer advanced content on the Tableau Community too.
Some call it a solution to dynamic parameters – which is the most requested product feature!
Do you build sparklines more efficiently than this method? We would love to update our calculation to offer a more efficient calculation.