Compute using

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:

  1. Click on the Context menu for the Remittances per Capita field on the Rows shelf.
  2. Click on Relative to.
  3. Select First, as shown in the following screenshot:
    Compute using

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:

Compute using

Moving average

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:

  1. Click on the Context menu of Remittances per Capita on the Rows shelf.
  2. Click on Clear Table Calculation.
  3. Click on the Context menu of Remittances per Capita again, select Quick Table Calculation, and then choose Moving Average.

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:

Moving average

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.

Editing table calculations

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:

  • Calculation Type: We can change the type of calculation via this option. Tableau Public automatically creates a different calculated field depending on our selection, and the options available in this user interface also vary based on the selection.
  • Summarize values using: This gives us the option to select the aggregation type. Ours is a SUM, but we can use AVG, MIN, and MAX in this type of calculation.
  • Moving along (or Compute using, with other table calculation types): This allows us to address the table calculation. In this example, we have only three options, namely Table (Across), Cell, or Date. The default is to compute by going across the table, which means that Tableau Public computes the values by going from left to right or top to bottom, depending on the location of the dimensions and measures.
  • When you click on the drop-down list, you can customize the way the field is computing by telling Tableau Public which fields to Compute using the first field, then the second, and so on. In the following screenshot, we have only one dimension, namely Year, in use. In case there were others, they would appear in the Partitioning pane, and we could add them to the Addressing pane and then sort them again. More on this will be discussed later.
  • The dimensions that we do not select for Compute using are used for partitioning, which is called grouping:
    Editing table calculations

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:

Editing table calculations
  • Null if there are not enough values, when selected, does not compute marks for places when there are not enough values. For instance, if you select this for this particular calculation, then the first two years in the visualization will not show a line.
  • Perform a secondary calculation on the result gives you the power to add additional table calculations. For instance, if this were a running sum that shows the cumulative total, we can use a percentage of the total secondary calculation to show the percentage accumulated for each year instead of the discrete number.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset