# Marginal Histograms in Tableau

152 views Comments last seen 2019/03/22 12:48:13am

I repeatedly tell my customers and students to come up with visualizations which are easy to read and informative. And the three important aspects of data visualization are:

• Make comparisons
• Visualize same dimensions or measures in different ways

And by putting marginal histograms in scatter plots or adding marginal bars on highlighted tables makes the visualization interactive, informative and impressive.

Let’s create the charts to make the things clearer.

Marginal histograms in Tableau

I am going to use the sample super store data and below will be my calculations for finding the age of the customer.

DATE(TODAY())-{FIXED [Customer Name]: MIN([Order Date])}

The formula here is simple to understand where it takes today’s date and subtract the minimum date (i.e. the date when the customer had his first purchase) for each customer name as the granularity I have put in the scatter plot is customer name.

Lot of insights from the simple scatter plot here (some mentioned below):

• Correlation between the age of the customer and their lifetime value
• Most of our customers are bunched between 3 to 4 years old

What if I add marginal histogram here in the scatter plot, will it not make things easy for me to find the distribution across measures? Let’s go and add it in the chart.

Here I have create a histogram horizontally with bin size of \$2000. As I need to put the histogram at the right side of the plot I had to make it as horizontal histogram.

Now, let’s create a histogram with age of the customer with the bin size of 50.

Now, little bit of formatting where I will put numbers in the label, do the color changes, reduce the opacity, add some borders.

It’s time to create a dashboard and put these charts there.

Here we go. Marginal histograms are ready and we are ready to analyse out data.

As looking at the scatter plot earlier we found out that

Most of our customers are between 3 and 4 years old, but now we can see the accurate distribution.

One more interesting insight here at y-axis, you can see that majority of profit values are between 0 and 500, and the second biggest distribution is actually at the negative value. This is an insight which we may not able to rectify only with the scatter plot.

Hope this makes a lot of sense and gave you a good idea about the marginal histograms. Come to join us at PST Analytics for Tableau Desktop training in Delhi and get an awesome learning experience.