Tableau Histogram is useful to visualize the statistical information that organizes within the user-specified range. Although it looks like a Bar chart, Histogram in Tableau displays data in equal intervals. This section shows how to Create Tableau Histogram with an example. For this demo, we use a custom query against the SQL Server.
-- 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
To create a Tableau histogram, Drag and Drop the Sales Amount from Measures Region to Text filed in MarksShelf. Next, select the Histogram option from the Show Me window
Once you select the Histogram option, a new Bin will create on the Sales Amount. Tableau Histogram will automatically add Sales Amount bin on Columns shelf and SalesAmount measure on Rows Shelf. As you see, the default bin size is 500, but you can change the range value by editing it.
From the above, see that the SalesAmount 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. Please refer to Tableau Bins to learn creation and editing bins. And also refer to Connecting to SQL Server and Bar chart in Tableau.
Once you select the Sum option, Histogram in Tableau will display the Sum of Sales Amount against the Sales Amount Bin
Our task is to display the Percentage of Total. To do that, select Quick table Calculation option from the menu and then choose the Percentage of Total
Once completed, the Histogram will display the Total Percentage of Sales Amount against the SalesAmount Bin
How to edit Histogram Table Calculation
If you want to edit the table calculation of a Tableau Histogram, Please choose Edit Table Calculation..
Once you choose the Edit Table Calculation.. option, a new window called Table Calculation will open to change the calculation type. From this drop-down list, select the required calculation.