Professional Documents
Culture Documents
Creating Bins 9
Creating Bins 9
TableauBins
TutorialGateway
TableauBins
01-09-2015 by suresh (http://www.tutorialgateway.org/author/sureshbabu/)
Tableau Bins are useful to create a Range of data, which is similar to SQL
Buckets. In this article we will show you, How to Create Bins in Tableau
(http://www.tutorialgateway.org/tableau/) with example. For this we are going to
write the Custom SQL Query against the SQL Server Data Source so, Please visit
Connecting Tableau to SQL Server (http://www.tutorialgateway.org/connectingtableau-to-sql-server/) article to understand the configurations. Custom SQL
query we are going to use for this report is:
T-SQL Query
1
2
3
4
5
6
7
8
9
10
SELECT Prod.Productkey,
Prod.EnglishProductName,
Prod.Color,
Prod.DealerPrice,
Fact.OrderQuantity,
Fact.TotalProductCost,
Fact.SalesAmount
FROM DimProduct AS Prod
INNER JOIN FactInternetSales AS Fact
ON Prod.ProductKey = Fact.ProductKey
TableauBinsExample
First,Drag and Drop the Product Key from Dimension Region to Rows Shelf. Next,
Drag and Drop the Sales Amount from Measures Region to Filed region. Since it is
a Measure value, Sales Amount will be aggregated to default Sum.Once you drag
them, table report is generated as shown in the following screenshot.
http://www.tutorialgateway.org/tableaubins/
1/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-2.jpg)
From the above screenshot you can observe that, there are 158 row
CreatingTableauBin
In this example we are going to create Bins or Buckets on Product Key so, Please
right-click on the Product Key dimension and select Create option and then
select Bins option from the context menu as shown below.
http://www.tutorialgateway.org/tableaubins/
2/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-3.jpg)
Once youselect Bins option, a new window called Create Bin will be opened with
default Name and default bin size 10.
http://www.tutorialgateway.org/tableaubins/
3/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-4.jpg)
If you dont know the bin size then click on the Load button. By clicking this
button, Tableau desktop will display the Minimum, Maximum, Difference values
and also the best possible Bin size as shown below
http://www.tutorialgateway.org/tableaubins/
4/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-5.jpg)
For now, We are using the Static Number 20 as Size of the bin and Click Ok
http://www.tutorialgateway.org/tableaubins/
5/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-6.jpg)
Below screenshot will show you the newly created Bin
http://www.tutorialgateway.org/tableaubins/
6/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-7.jpg)
Please replace Product Key dimension with Product Key Bin on Row Shelf
http://www.tutorialgateway.org/tableaubins/
7/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-8.jpg)
From the above screenshot you can observe that, Product Key Data is organized
into Buckets and the total rows are 21 only
To display the product keys available in each bin, Drag and Drop the Product key
dimension to the Row Shelf
http://www.tutorialgateway.org/tableaubins/
8/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-9.jpg)
DeletingTableauBins
It is very easy and straight forward to delete the Bins in Tableau. To do so, Select
the Bin you want to delete and right-click on it will open the context menu. From
the context menu, Please select the Delete Option as shown below
http://www.tutorialgateway.org/tableaubins/
9/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-10.jpg)
CreatingStackedBarChartsusingTableauBins
Tableau allows us to create Bins on both Dimensions and Measures. In this
example we will create Bins on Measure value and using that Bin value, We will
create Stacked Bar Charts.
Following screenshot will show you, Default Bar Chart with Color dimension on
Row Shelf and Sales Amount on Column Shelf
http://www.tutorialgateway.org/tableaubins/
10/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-11.jpg)
Right Click on the Sales Amount Measure and select Create Bins option from the
context menu. For Now, we are using the default bin size generated by the
Tableau Desktop (i.e., 357.598)
http://www.tutorialgateway.org/tableaubins/
11/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-12.jpg)
Next, Drag and Drop the newly created Sales Amount bin from Dimension region
to theColor Option in Marks Card as shown below
http://www.tutorialgateway.org/tableaubins/
12/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-13.jpg)
Once you are done, You can see the Stacked Bar Chart As shown in below
screenshot. Tableau Desktop allocate default colors to stacked bars but, You can
edit the colors by selecting the Edit Colors.. option from the context menu.
http://www.tutorialgateway.org/tableaubins/
13/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-14.jpg)
Let us add the Data Labels and see, whether we successfully created the stacked
bar charts using the Tableau Bins or not
http://www.tutorialgateway.org/tableaubins/
14/15
12/29/2015
TableauBins
(http://img.tutorialgateway.org/2015/09/Tableau-Bins-15.jpg)
Thank You for Visiting Our Blog
http://www.tutorialgateway.org/tableaubins/
15/15