What gifts do people plan to spend money on Valentine’s Day?

 By: Rosario Gauna @rosariogaunag

For week 7 of #WorkoutWednesday, @lorna_eden prepared and delighted us with a challenge with a design and information especially dedicated to the date: What gifts do people plan to spend money, on Valentine’s Day?

In her challenge, Lorna indicates that she is looking for reinforcement in several areas, one of them, the handling of Radar Chart.

This blog will focus on the process of building Radar Chart, a type of chart that often has the label of “complicated”. I hope to help in this blog, to leave behind the negative labels with respect to working with this type of chart.

I share below the procedure I followed to create the radar charts per year that asks us the Lorna challenge.


Step 1: Pivot data from Columns to Rows

Since in the data file the information for each type of gifts is shown in independent columns, the first step that is required is to convert those columns into rows. This in order to facilitate working the data in Tableau.

For which, after you have set up the data source, in the grid, select the 7 columns corresponding to the names of the gift types. Click the drop-down arrow next to the column name, and then select Pivot.

This operation creates two new columns called “Pivot field names” and “Pivot field values” are created and added to the data source. The two new columns replace the 7 original columns that you selected to create the pivot.


Step 2: Rename the new columns created in the Pivot.

To give a meaning more consistent with the data handled, the two new columns will be renamed:

  • “Pivot field names” will be renamed “Type of Gift”
  • “Pivot field values” will be renamed “Percent Buying”


As I read this week’s challenge, I immediately recalled a previous challenge from @LukeStanke on Radio Charts at week 10 of  # WorkoutWednesday2018. In that challenge, Luke included within the spoilers the following formulas for the calculation of coordinates (x, y).

  • Radius * SIN(2 * PI() * [Percent of Circle]) will return your X-axis
  • Radius * COS(2 * PI() * [Percent of Circle]) will return your Y-axis

These formulas will also be very useful in solving this week’s challenge.

If you aren’t familiar with these formulas, I ask you not to worry, because in this blog we will review the basic concepts of its operation and you will be able to verify for yourself that it’s precisely these formulas that will make the hard work for us and not the other way around.

To use the formulas for the calculation of coordinates (x, y), we must previously calculate two basic variables: “Percent of Circle” and “Radius”.

Step 3: Calculate the “Percent of Circle” field.

This variable will determine the position that each of the types of gifts will occupy, seeking to distribute them uniformly within a range between 0 and 1.

For your calculation you should consider: 1) The order in which each type of gift will be displayed, 2) The total number of types of gifts that will be graphed, which in this exercise is 7.

This will help us to have each type of gift have a position within an imaginary circle (as if there will be 7 stops within the rotation of a few hands of clock), depending on the order in which each type of gift will be displayed.

For this calculation, I preferred the use of a simple formula in order to focus on better understanding what is sought.

Percent of Circle =

CASE [Type of Gift]

WHEN ‘Jewelry’ THEN 0/7

WHEN ‘Greeting   cards’ THEN 1/7

WHEN ‘Gift  card/gift certificate’ THEN 2/7

WHEN ‘Flowers’ THEN 3/7

WHEN ‘Clothing’ THEN 4/7

WHEN ‘Candy’ THEN 5/7

WHEN ‘An  evening out’ THEN 6/7


We already have the first of the two basic calculations, nothing complicated, right?

Step 4: Calculate the “Radius” field.

The “Radius” is intended to help determine how far away from the center of our imaginary circle will be each point. The higher the percentage of purchases by type of gift, the point will be further from the center.

In this exercise, the original data contains the percentage of purchases of each type of gift. Therefore, we will only take the data, without the need for additional calculations.

Radius = SUM([Percent Buying])

So easy, we already have the second variable required by the formulas of the coordinates.


Step 5: Calculate coordinates (x, y).

At this point, we will see how the formulas for obtaining coordinates (x, y) will make the work really difficult for us.

x = [Radius] * ATTR (SIN (2 * PI () * [Percent of Circle]))
y = [Radius] * ATTR (COS (2 * PI () * [Percent of Circle]))

In the following image, an example with the information of the year 2018, of the basic data calculated in steps 3 and 4 is shown. And as after the formulas are applied, they are transformed into coordinates (x, y).



Step 6: Create chart.

For the creation of the chart it is necessary to filter the data to work only with those that meet the condition of Tableau = “Null”. This is because the data included additional records in order to create a heart image in an independent chart and that should not be considered for this chart.

To create the radar chart, you must select the option of polygons in the mark’s menu. Remember that polygons are points that are connected by lines that surround an area.

In this exercise, the points to be connected will be located in the previously calculated coordinates and you must indicate on the “Path” shelf, the order in which the lines will be drawn to connect the points. By joining the points or vertices of the polygon, the radar images will be formed.

Move to the shelves of:

  • Filters ⬅  Filter the data: Keep those that meet the condition Tableau = NULL
  • Columns ⬅  “x”
  • Rows ⬅  “y”
  • Color ⬅  “Year” sorted descending, to create a radar per year
  • Tooltips ⬅  “Percent buying”
  • Path ⬅  “Type of Gift”

In color, use the 25% opacity effect and the border effect to create the line around each polygon.

The chart uses a double axis to include small circles at each vertex in the polygon.

For which a copy of the variable “y” is included in the “Rows” shelf and the “Circle” mark is selected for the second axis.


Adjust the tooltips and the formats.

I hope this blog has helped to break down the negative labels that radar charts are complicated and that they feel comfortable trying their own creations with new data.

Thanks Lorna, for preparing us such a special challenge for Valentine’s Day.

Link to Tableau Public


I take this opportunity to thank you, because I’m very moved by all the messages of support received. It’s an incredible honor for me, to be part of the Tableau Zen 2019 group.

I want to especially thank all those people who have supported me in my learning and who have motivated me to try new challenges.

I hope to continue having fun with new learnings and continue having the privilege of being able to share them with you.

Thank you! Thank you!! Thank you!!!

Rosario Gauna