top of page
Bernard K

Creating a Histogram in Tableau - Highlighting the Mean, Median, and Mode


histogram makeover in tableau

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.

example of a basic histogram

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.

modified histogram

(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).

sample data screenshot

To create the modified histogram graph, let’s first create Price (bins) using this simple calculation.

creating bins in tableau using calculations

(Note, this creates bins of size 100)

Next, let’s compute the Mean and Median price using these two calculations.

computing the mean value in tableau
computing the median value in tableau

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).

computing the mode value in tableau

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.

adding reference lines in tableau

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!

Blog.png
Black & white.jpg

About Me

More About the Author

Bernard K

Analytics Consultant | 3X Tableau Certified

Bernard is a data analytics consultant helping businesses reveal the true power of their data and bring clarity to their reporting dashboards. He loves building things and sharing knowledge on how to build dashboards that drive better outcomes.

Let’s discuss your data challenges! Let’s work together!

bottom of page