Introduction to Histogram in Tableau
A histogram is a visualization tool that plots frequency distribution for a variable. It resembles a bar graph except that unlike the bar graph which requires two variables, the histogram requires only one variable. It creates bins that represent ranges and calculates the number of occurrences of variables values in those ranges. The frequency of a bin determines the height of the bar for the bin. Histograms are quiet popular in field studies as they offer quick insights into a frequency distribution. In statistical terms, a histogram is a very powerful tool as it helps understand the distribution for a variable and validate the normality assumptions.
Creating Histogram in Tableau
Now, we’ll see how to build an insightful histogram in Tableau. For the demonstration, we are considering annual sales by region data. It contains daily sales for one complete year by region for four different regions viz. East, West, North, and South. We intend to analyze the sales performance in these regions using a histogram. Let’s proceed with a step-by-step approach as below.
- Load the data into Tableau. For that Click on “New Data Source” in the Data menu. Alternatively, click on “Connect to Data”.
2. In “Connect”, click on the requisite data source type. In this case, the data source type is Microsoft Excel, so click over it.
3. The data gets loaded and can be seen in the “Data Source” tab as shown below.
4. Moving to the sheet tab, we can see the dimension Region and measure Sales present in the respective sections.
5. Now, just drag measure Sales into Rows region. We get a single bar for measure Sales as shown below. The bar, as such, doesn’t offer any insight.
6. To create a histogram on measure Sales, click on the histogram in Show Me as illustrated below. Hovering mouse over the histogram symbol gives us the detail that it requires only a single measure.
7. Following the above steps result in the histogram which is as shown in the below screenshot. We also see an automatically created dimension Sales (bin) which will be used as a bin for histogram creation.
8. The following screenshot shows the automatically created dimension Sales (bin) highlighted.
9. The following screenshot gives a closer look into the visualization. The histogram is for all four regions. In the Columns region, we have dimension Sales (bin) while in Rows region automatically CNT i.e. Count function got applied over measure Sales. CNT function counts the number of values of measure Sales in a bin. Our goal is to obtain four different histograms for four different regions.
10. To have histograms by region, just drag dimension Region into Columns region as shown below, and we get four different histograms for four different regions. However, the following visualization is crude. We will refine it by distinguishing the regions by different colors and setting proper ranges for the horizontal axis of each region. Let’s see how we accomplish that.
11. Drag Region over Color in Marks card as shown in the below screenshot. We can see that, now, four regions have been represented by four different colors that help us visualize and distinguish amongst them in a better way.
12. The following screenshot gives a closer look into the histograms. Now, we want to have different horizontal axis ranges for different regions. This is essential as the four regions have the same horizontal axis range. If for a region, no values are present for a range then histogram gets pushed either to left or right which gives the visualization awkward appearance as can be seen below for South and West regions. In order to have different axis ranges for different dimension (Region) values i.e., just right click on the horizontal axis as shown in the below screenshot and click on “Edit Axis…”.
13. Clicking on “Edit Axis…” generates Edit Axis dialogue box as can be seen below. In the “Range” section the default selection is “Automatic” that keeps the same range for all the values of the dimension. Select “Independent axis ranges for each row or column” as shown below. Selecting this option will create different horizontal axis ranges for different dimension (Region) values. So, it essentially, creates the range, based on the lowest and highest value of the measure for that dimension, which is used in histogram creation.
14. As we can see in the below screenshot, now, following the above procedure has set different ranges for each region, and unlike the earlier visualization, the histograms now have got properly centered along the horizontal axis.
15. If we study the histograms, we can see that a good number of bins have been created. It means the range of values for bin creation is small. Remember, smaller the size of the bin, more the number of bins and vice versa. Tableau automatically selects bin size before creating the histogram. However, we can manually specify the bin range. This we can do by clicking on the dropdown menu of dimension Sales (bin) and selecting “Edit…”.
16. Once we click on “Edit…” as mentioned above, Edit Bins [Sales] dialogue box pops up. Here, we can see that the default size of the bin considered is 132. In the screenshot subsequent to the below one, we can see that, bin size can be specified manually or through a parameter.
17. We specified the value of 200 in the “Size of bins” option in the above dialogue box. As can be seen below, we got histograms with a lesser number of bins as compared to the earlier version. Having too many bins may not always be useful for insight derivation.
4.5 (2,345 ratings)
18. The following screenshot shows histograms with a bin size of 400. Hovering mouse over any bin gives details pertaining to the bin.
A very important and powerful tool for exploratory analysis, a histogram is commonly used for variable distribution analysis. Tableau is a visual analytics tool that comes with a user-friendly approach to create and analyze histograms. In a way, Tableau offers a self-guided approach to create histograms by providing useful tips to the user. However, there are certain intricacies that must be understood. These are usually related to certain settings pertaining to the visualization which must be modified in order to obtain more insightful results. Moreover, histograms must be created taking into consideration the context and that they convey right and useful insights.
This is a guide to the Histogram in Tableau. Here we discuss the introduction of the Histogram in Tableau, Creating of Histogram in Tableau and the basic points. You can also go through our other suggested articles to learn more–