Introduction
Histogram is a graphical representation that shows the distribution of numerical data. It is the type of bar chart that shows the frequency or number of observations within different numerical ranges called bins. The bins can either be fixed size or varying bin sizes.
Here is a basic example of a histogram graph.
Note: The length of the bars represents the number of observations that falls within that range.
Now, let’s make this histogram graph more useful by adding another layer of information to it. We can add a new layer of information by highlighting the Mean, the Median, and the Mode values of the data as reference lines.
See what am referring to.
(In the second view, you can see the distribution of data - as well as the Mean, the Median, and the Mode values).
How to remodel your histogram
The sample data (screenshot).
To create the modified histogram graph, let’s first create Price (bins) using this simple calculation.
(Note, this creates bins of size 100)
Next, let’s compute the Mean and Median price using these two calculations.
Next, let’s compute the Mode price using the following series of calculations.
Note: This example assumes that our data has a single value as the mode (unimodal distribution).
Building the view
Add Price (bin) as a continuous field to the columns shelf.
Add CNT (Order ID) to the rows shelf to see the number of orders per Bin.
Format your view.
Next, drag the statistics Mean, Median, and Mode to the detail shelf as shown below.
Note: Mode is aggregated by average i.e., AVG(Mode).
Add the statistics to the view by right-clicking on Price (bin) axis and select Add Reference Line…
Add each statistic using the same technique. In this case, I am adding the Mode value as a reference line.
Format and customize each reference line to get a view like this one.
I hope this article was helpful to you. If you wish to receive more Tableau tips and tricks, kindly join our mailing list by subscribing below.
If you like the work we do and would like to work with us, drop us an email on our contacts page and we’ll reach out!
Thank you for reading!
Comments