Challenge, Workout Wednesday, Polygons, LOD calculations, Table calculations, synchronized double axes

By: Rosario Gauna @rosariogaunag

In week 36 of Workout Wednesday, @RodyZakovich prepared a challenge that allows us to visualize reference bands as the background of a scatter chart, giving a more elegant touch to the design by adding a third dimension to the visualization.

Link to challenge

Link to the data

Before starting the procedure, I would like us to take some time to understand how the chart is made up:

Step 0: Understand the structure of the chart.

The “x” axis represents the total number of games in which the players participated.

The “y” axis represents the total number of points scored by players throughout their career.

The reference bands, used as a background, represent a third axis on which all those players are grouped in which their average points scored per game are within the range defined in each segment or band color.

The reference bands used as a background are created in this procedure with polygon shapes by joining 4 dots. Next, I share a diagram with the calculation of the coordinates (x, y) for the 4 dots, for each of the reference bands, considering that the range of the bands is of size 5.


As you can see, the starting dot and the end dot of each polygon, that is, dots 1 and 4, will always be located in the coordinates (x = 0, y = 0).

Dots 2 and 3 of the polygons, on the x axis, will be at the maximum point established, in this case it is 1700. Why is 1700 used as the maximum value? Because the player with the highest number of games has participated in 1611 and to give a margin will be used 1700.

The values of dots 2 and 3 of the polygon, on the “y” axis, will be the result of multiplying 1700 games bythe minimum value for dot 2 or by the maximum value for dot 3, of the average points that can be obtained each player to belong to a specific band.

Although it was not a requirement of the original challenge, the procedure that I share below includes the possibility for the user to choose between different band sizes.

Step 1: Model the data – Create 4 copies of the data.

One of the techniques to achieve this goal is to create the “Union” of the data with itself. In this case four copies of the data are required.


Why do I need four copies of the data? To be able to have 4 marks or dots to form each polygon. From each data copy I get a dot that make up the “Path” of each polygon.

Remember that to identify the copy of the data being treated, Tableau automatically creates a new dimension called “Table Name” with four different values, in this case, the values are “Data”, “Data1”, “Data2”, “Data3”.

According to the four values automatically assigned in “Table Name”, we create a new variable called “Dot” with values 1, 2, 3 and 4.


Step 2: Create the “Size of Band” parameter for the user to select the difference points that will define the band size.

An integer, with a minimum value of 3 and a maximum of 7, with increments of 2 in 2. With a current value of 5.

Step 3: Calculate the average points per game for each player.

Avg Points per Game =

ROUND({FIXED [Player] : AVG([PTS] / [Adjust Games])}, 2)

Step 4: Calculate the rank of the players based on the total points scored in his career and create the label of the 10 players with the best rank, indicating his Rank and last name.

Rank = Rank(SUM([PTS]))
Top 10 Players =

IIF([Rank] < 11,

‘#’ + STR([Rank]) + ‘ ‘ +

UPPER(MAX(TRIM( SPLIT( [Player], ” “, -1 ) ))), NULL)

Step 5: Calculate the minimum value of average points per game that identifies each band.

Low Band =

INT([Avg Points per Game] / [Size of Band])

* [Size of Band]

For a “Size of Band” of 5, the possible values with the current data for “Low Band” are: 10, 15, 20, 25, 30.

Step 6: Calculate the label of the reference bands, indicating the minimum and maximum integer values of average points per game to belong to each band.


Step 7: Calculate coordinates (x, y) for each dot of each polygon.

The calculation of the variables “x” and “y” will be made according to the instructions of step zero.

Picture5The subtraction of 0.1 to the band size generates the space or white lines that appear between the bands.

Right click on both fields and select the option “Default Properties – Aggregation – Minimum”

Step 8: Create the chart with the definition of the polygons.


According to the indications of @RodyZakovich, adjust the range of the axis of the “x” between the values 715 and 1667 and adjust the range of the axis of the “and” between the values of 17900 and 39900.


Step 9: Continue with the definition of the chart. A “Shape” chart will be added, which will synchronize its “x” and “y” axes with the axes of the polygon chart.


For the variables of “Rank”and “Top 10 Players Label”that use a table function within their formula, it must be established that the table calculation is by specific dimensions: “Player”, “Is Active” and “Band”.

Step 10: Adjust the tooltips and the formats.


Link to Tableau Public


I take this opportunity to thank @RodyZakovich for sharing this interesting challenge.

If you have any questions about the blog, do not hesitate to contact me on twitter (@rosariogaunag)


Rosario Gauna