Quadrant Analysis in Tableau. Learn how to analyze data in the form... | by Parul Pandey | Towards Data Science

If you are a part of the Data Science ecosystem, you must have heard about Gartner’s Magic Quadrant(MQ). These MQs are a series of reports containing the market research and analysis of several technology companies. They are one of the most anticipated and awaited reports in this space. Here is the 2020 Magic Quadrant for Analytics and Business Intelligence platforms. You can clearly see the four distinct quadrants denoting four different categories.
A quadrant chart is technically a scatter plot divided into four equal sections or quadrants, hence the name. A quadrant Analysis chart combines similar data points, thereby putting them in the same quadrant. Tableau is a great data analytics and visualization tool used widely in the industry today. In this article, we’ll learn how to create a quadrant chart in Tableau. We’ll go a step further and make it responsive too.
We’ll use the famous Superstore dataset for the demonstration. The data is that of a United States Superstore and contains information about products, sales, profits, etc. You can use it to identify critical areas for improvement within this fictitious company. The first step would be to import the dataset and explore it. You can download the data from here.
This tutorial assumes some familiarity with Tableau, its properties, and its use to do the analysis.
Let’s use Python to import the dataset and explore it.
import pandas as pd  import numpy as npsuperstore_data = pd.read_excel('Sample-Superstore .xls',header = 3)  superstore_data.head()
The dataframe shows the first five rows of the dataset containing different attributes. Let’s also check if there are any missing values :
superstore_data.info()
The information above shows that there are no null values and a total of 9994 records. We’ll now import the dataset in the tableau workspace.
Import the Data into the Tableau workspace from the computer.
Under the Sheets Tab, three sheets will become visible, namely. Orders, Peopleand Returns. In this article, we will focus only on the Orders data. Double click on Orders Sheet, and it opens up just like a spreadsheet.
We observe that the first three rows of data look different and are not in the desired format. We shall use Data Interpreter, also present under the Sheets tab, to rectify this. The data interpreter renders the existing sheet into a nicely formatted one.
Let’s say we want to see how Discount is related to Profit of the Superstore, and which products are more profitable than the other. The first step is to create a simple scatterplot between Discount and Profit Ratio. Profit Ratio gives a better sense than the field of Profit alone. The Profit Ratio attribute is not present in the original dataset. Hence, we shall create it as follows:
Open up a new worksheet and create a new calculated field called Profit Ratio by using the formula mentioned below.
sum([Profit])/sum([Sales])
Drag Discount to Columns and Profit Ratio to Rows. Then drag the Sub Category on to the Colors Shelf. Convert the measure of Discount to Average. You'll get a scatter plot where each circle represents a specific product.
Now that we have a basic scatter plot, it’s time to create the two parameters, which will act as the reference for quadrants calculation. In our case, we shall create a Discount Parameter and a Profit Ratio Parameter, which will be derived from the Discount and Profit Ratio Fields, respectively.
Discount Parameter
Click on the Discount field > Create > Parameter and fill in the values shown in the figure below. Set the Current Value to any value of your choice. (in this example, 0.2).
Profit Ratio Parameter
Perform the same steps as above using the Profit Ratio field also. This will create the Profit Ratio parameter.
A new heading called Parameters is now visible in the worksheet containing both the newly created parameters.
Tableau's reference line is simply a vertical or horizontal line on a graph representing a point of reference. For instance, a reference line drawn on a Sales chart can easily differentiate between high and low sales points. We shall be creating two reference lines, one for each axis.
Right-click on the Profit Ratio axis (y) and select Add Reference Line.
Set the Reference line Value to the Profit Ratio Parameter.
Leave the other fields with their default values and click OK.
Right-click on the Avg Discount axis (x) and select Add Reference Line.
Set the Reference line Value to the Avg Discount Parameter.
Leave the other fields with their default values and click OK.
We now have our four quadrants, but the data points in every quadrant are randomly colored. We can write a simple calculation that assigns a color to a data point based on its quadrant, i.e., UPPER RIGHT, UPPER LEFT, BOTTOM RIGHT, or BOTTOM LEFT.
Click Analysis > Create calculated field and name the field as Quadrant Color.
Enter the formula as mentioned below:
IF AVG([Discount]) >= [Discount Parameter]  AND [Profit Ratio] > [Profit Ratio Parameter] THEN 'UPPER RIGHT'  ELSEIF AVG([Discount]) < [Discount Parameter]   AND [Profit Ratio] > [Profit Ratio Parameter] THEN 'UPPER LEFT'  ELSEIF AVG([Discount]) >[Discount Parameter]   AND [Profit Ratio] < [Profit Ratio Parameter] THEN 'BOTTOM RIGHT'  ELSE 'BOTTOM LEFT'  END
The data points currently have been colored by the Sub-category. However, we want to color them with their respective quadrants. Drag the Sub-Category field on to the Detail card and Quadrant Color field on to the color. Instantly all data points are now colored as per the quadrant in which they fall. Change the Shape to circle to get filled circles and adjust the size and tooltip preferences accordingly.
So here we have a Quadrant Analysis of the Discount and Profit Ratio of an American Superstore. It is pretty evident from the graph that products which lie in the Bottom Right are the least profit-making products while the ones lying in the Upper Left are the most profitable ones.
The quadrants in the above chart are fixed and can only be changed once we change the linked reference lines' values. What if we want to experiment with different thresholds to see how the products change their quadrants in real-time? This is possible and is referred to as a dynamic quadrant chart and is achieved through the Actions.
Actions are a feature in Tableau that lets us add interactivity to the data. With this feature's help, we can interact with our visualization by either selecting, clicking, or hovering on them. Actions can perform the following tasks in a visualization:
Let’s now set up a worksheet action with the following steps:
Goto Worksheet>Actions and add Change Parameter action. This is because we want to create an action that changes the parameters accordingly.
Next, we will name the action as Update Discount Parameter and select the corresponding Target Parameter and Value, which in this case would be Discount Parameter and AVG(Discount) respectively.
Similarly, we’ll create another action called Update Profit Ratio Parameter.
Now, as we click on a data point, it becomes the center of the Quadrant. Thus w now get is a dynamic quadrant chart. We can see how changing the values of Profit Ratio, and Discount varies the position of products in the quadrant.
In this article, we learned how to convert a scatter plot to an interactive quadrant chart. A quadrant chart gives an overall view of data. As an activity, you can pick two fields of your choice from the existing dataset and perform quadrant analysis among those fields to cement this concept.