The graph from the previous exercise calculates the percentage difference from year to year, which means that the value for each year is being computed relative to the previous year. We can ask Tableau Public to calculate the percentage difference from different years by clicking on the Context menu for a table calculation of this type, and then selecting Relative to. We can calculate the change from the first, next, previous (the default one), or last values in a partition.
In the following graph, which is a revision of the previous one, the bar height for each year shows the aggregated percentage difference in Remittances per Capita since 1980, which is the first year in the visualization. You can do this by performing the following steps:
Then, perform the same calculation on GDP (current USD). We changed its use on the Rows shelf into a quick table calculation for the percentage difference and set it to Relative to for the First value in the partition.
We took one extra step—we right-clicked on the secondary y axis, where the GDP (current USD) table calculation resides, and selected Synchronize Axis so that the axis ranges of both the y axes are the same. This is an important step because we want to make sure that the consumers do not perceive a relationship that is different from the one that we intend to communicate.
In the following graph, you will see that just around the turn of the century, the GDP rate of change since 1980 slowed down, and the rate of change of Remittances per Capita overtook it:
The moving average is a powerful table calculation because it gives you the ability to determine how many previous and future values are included in an average.
For instance, we can change the percent difference table calculation that we performed on Remittances per Capita by performing the following steps:
We cleared the table calculation for GDP (current USD) in the following graph as well.
The following graph shows the moving average of Remittances per Capita since 1980 versus the GDP:
One thing that we don't know is exactly how smooth the line is. The term "smooth" means that more than one value is included in the calculation, and if we edit the table calculation, we can control the smoothing. You can also create a parameter that gives users a control over the smoothing. More on this will be discussed later in the book.
So far, we have used only the default settings for the table calculations that we have created. Tableau Public gives us several capabilities. Right-clicking on the pill for the moving average of Remittances per Capita shows us the following options that are available for this field:
The next feature allows you to tell Tableau Public how many previous and future values to include, and you can also determine whether the current values should be included. Lines that are smoother include more previous and future values as shown in the following screenshot: