Tableau Histogram is useful to visualize the statistical information, that is organized in user-specified range. Though it looks like a Bar chart, Histogram in Tableau display data in equal intervals.
In this article, we will show you, How to Create Tableau Histogram with an example. For this we are going to write the Custom SQL Query against the SQL Server Data Source. So, Please visit Connecting to SQL Server article to understand the configurations.
Custom SQL query we are going to use for this Tableau Histogram report is:
-- Tableau Histogram Data Source SELECT Geo.EnglishCountryRegionName, Geo.StateProvinceName, Geo.City, Prod.EnglishProductName, Prod.Color, Fact.OrderQuantity, Fact.TotalProductCost, Fact.SalesAmount, Fact.TaxAmt, Fact.[Freight] FROM DimProduct AS Prod INNER JOIN FactInternetSales AS Fact ON Prod.ProductKey = Fact.ProductKey INNER JOIN DimSalesTerritory AS Terry ON Terry.[SalesTerritoryKey] = Fact.[SalesTerritoryKey] INNER JOIN DimGeography AS Geo ON Geo.[SalesTerritoryKey] = Terry.[SalesTerritoryKey]
Create a Tableau Histogram
In order to create a tableau histogram, Drag and Drop the Sales Amount from Measures Region to Text filed in Marks Shelf and select the Histogram option from the Show Me window as shown below
Once you select the Histogram option, a new Bin will created on Sales Amount.
Tableau Histogram will automatically add Sales Amount bin on Columns shelf and SalesAmount measure on Rows Shelf.
If you observe the below screenshot, the Default bin size is 500 but you can change the range value by editing it. Please refer Tableau Bins article to understand the creation and editing bins in Tableau.
From the above screenshot, you can see, the Sales Amount on Rows shelf is aggregated by Count rather than Sum. To change the aggregate function, Please click on the down arrow beside the measure and change the Measure value from Count to Sum as shown below
Once you select the Sum option, Histogram in Tableau will display the Sum of Sales Amount against the Sales Amount Bin
In this example, Our task is to display the Percentage of Total. In order to do that, Please select Quick table Calculation option from the drop-down menu and then select the Percentage of Total as shown below
Once you are done, histogram in tableau will display the Total Percentage of Sales Amount against the SalesAmount Bin
How to edit Tableau Histogram Table Calculation
If you want to edit the table calculation of a Tableau Histogram, Please select Edit Table Calculation.. from the drop-down menu
Once you select the Edit Table Calculation.. option, a new window called Table Calculation will open to change the calculation type. From this drop-down list, you can select the required calculation