Tutorial
This tutorial is part of a series of tutorials on period over period analysis in Tableau. You can find the previous tutorial here:
An interesting way to display period over period comparisons is when involving the bubble chart because it involves some deep understanding of how Tableau works. In this tutorial, we will see how to build such a chart (part C of the tutorial series).
Let's assume you have to compare 2 metrics and their respective evolution against a given dimension. The bubble chart with one metric on the X axis, the other on the Y axis and the dimension on the detail shelf is a good way to do this.
To do so, simply follow the steps below :
Here's how it should look like :
If you need them, here are some images you may use for the shapes :
That is all well and good and works well for simple cases such as month vs month-1. Basically you can stop the tutorial now if the comparison period never overlaps with the selected period (which should be enough for most usecases). However, if the comparison period overlaps with the selected period, some data will be missing for the comparison period since it'll already be shown in the selected period "bubble". Let's see how to fix this in part two of this tutorial
Again, let's remind you that if your comparison period do not overlap with the selected period, you can stop the tutorial now. However, if you need to display overlapping periods, you will need to use Level-Of-Detail Expressions and adapt slightly the previous steps.
Let's try to vizualise the issue first. Let's say we want to compare the sales of the last 3 months with the sales 2 months before. We should have an overlap of 1 month which should look like this :
Basically if we do nothing to our viz, the metrics for the comparison periods in the last month will be missing since they are already displayed in the selected period. The comparison period is simply computed over 2 months while the selected period is computed over 3 months.
Here is how we may formulate the issue:
Said differently:
Now, we will take [Sales] and [Profit] as examples for our bubble chart.
When can decompose our new calculation into 2 sub-cases:
Basically, the formula becomes :
IF [f. Is In Period] THEN
{ EXCLUDE [f. Is This Period]: SUM(IIF([f. Is This Period], [Sales], NULL))}
ELSE
{ EXCLUDE [f. Is This Period]: SUM(IIF([f. Is Last Period], [Sales], NULL))}
END
Simply repeat the operation for the [Profit] metric and you should get the following result :
And that's all there is to it ! You can simply replace the Row and Column pills with your own metrics and you should get the following result (here I went further and added trails between periods by using dual-axis for both rows and columns) :
Additionally, you can use Tableau double-axis feature to draw lines between each period to further give your users the feeling of evolution from one period to the next.
Here is how it looks now:
Final disclaimer: It is important to understand that this chart still is not perfect. In the case of a very "sparse" dataset where data is not continuous, it may happen that some "dotted" circles will not appear when there is no data in the "left" part of the comparison period. There is basically no way around it so you should only use this chart when your dataset is "continuous" and does not present gaps.
Happy Tableauing!