Tableau Histogram is useful to visualize the statistical information, that is organized in user specified range. Though it looks like Bar chart, Histograms display data in equal intervals.
In this article we will show you, How to Create Tableau Histogram with 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 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 be created on Sales Amount.
Tableau Histogram will automatically adds Sales Amount bin on Columns shelf and Sales Amount 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 observe that, 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 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, tableau histogram will display the Percentage of Total Sales Amount against the Sales Amount Bin
How to edit Tableau Histogram – Table Calculation
If you want to edit the table calculation, Please select the Edit Table Calculation.. from the drop down menu
Once you select the Edit Table Calculation.. option, a new window called Table Calculation will be opened to change the calculation type. From this drop down list, you can select the required calculation