Tableau Box Plot is useful for graphically visualizing the numeric data, group by specific data. Let us see how to Create a Box Plot in Tableau with an example.
How to Create a Tableau Box Plot
In this example, we are going to create a boxplot in Tableau. For this Tableau boxplot demo, we write the Custom query on the SQL Server Data Source.
-- SQL Query to create a Box Plot in Tableau SELECT ProdCat.EnglishProductCategoryName, ProdSubCat.EnglishProductSubcategoryName, Geo.EnglishCountryRegionName, Geo.StateProvinceName, Geo.City, Geo.PostalCode, Geo.IpAddressLocator, Prod.EnglishProductName, Prod.Color, Prod.DealerPrice, Cust.FirstName, Cust.LastName, Cust.Gender, Cust.YearlyIncome, Cust.EnglishEducation, Cust.EnglishOccupation, Fact.OrderQuantity, Fact.TotalProductCost, Fact.SalesAmount, Fact.TaxAmt, Fact.OrderDate FROM DimProductSubcategory AS ProdSubCat INNER JOIN DimProduct AS Prod ON ProdSubCat.ProductSubcategoryKey = Prod.ProductSubcategoryKey INNER JOIN DimProductCategory AS ProdCat ON ProdSubCat.ProductCategoryKey = ProdCat.ProductCategoryKey INNER JOIN FactInternetSales AS Fact ON Prod.ProductKey = Fact.ProductKey INNER JOIN DimCustomer AS Cust ON Fact.CustomerKey = Cust.CustomerKey INNER JOIN DimGeography AS Geo ON Cust.GeographyKey = Geo.GeographyKey
For this, first drag and drop the Sales Amount from Measures Region to Rows Shelf, and Color from Dimensions region to Details field present in Marks Shelf.
From the below screenshot, you can see the Tableau Boxplot.
Let me drag the English Country Region Name from Dimensions to Columns Shelf. It will create a box plot for each country
You can hover over the mouse on the box plot to see the Median, Upper Quartile, Lower Quartile, and the Whisker values.
Change Colors of a Tableau Box plot
We show you how to change the colors of a Tableau Boxplot boxes. Tableau provides two different approaches to this.
First Approach: Please right-click on the box plot and select the Edit.. option from the context menu.
Once you select the Edit.. option, a new window called Edit Reference Line, Band, or Box will open to style the box plot.
Second Approach: Go to the Format menu and select the References Lines… will open the Format Reference Lines tab.
Let me change the Fill color to the Red pallet.
Next, we are changing the Border width and border color for Tableau box plot
Lastly, we are changing the Tableau Whiskers width and color
Change Colors of a dots in Tableau Box and Whisker Plot
This example explains how to add colors to the dots in the Tableau boxplot. For this, drag and drop the English Country Name from Dimensions Region to the Color field in Marks Shelf, as shown below. It means each country has its own color
Change the Size of a dots in Tableau Box Plot
In this example, we will show you how to change the size of the dots in a box plot. For this, drag the Order Quantity from Measures Region to Size field in Marks Shelf.
Create Categorical Box Plots in Tableau
Here, we show how to create a boxplot in Tableau for each color within a region. For this, drop the Color from Dimensions Region to Columns Shelf.
By default, the box plot displays the horizontal lines (or dots), and they are the compressed box plot. Because it is difficult to draw the box plots for aggregated data, so, let’s remove the aggregated measure by unchecking the Aggregate Measures available in Analysis Menu.
Now you can see the box plot for each color present in a region.
Horizontal Tableau Box and Whisker plot
Change the default vertical box plot into a horizontal box plot by swapping rows and columns.
See the horizontal box plot.