9 Replies Latest reply on Jan 25, 2017 9:18 AM by Rob Kime

# Compare Two Histograms in Tableau 10 Desktop

Tableau Community,

I want to create a Viz that layers two histograms to show the contrast between the distribution of male and female incomes income bin.

My Tableau workbook and raw data are attached including a picture of the view created in Excel.

Losing my mind . . . I've tried this a  number of different ways . . . including a calculated field for male and female income that creates the bins . . . seems to be same result as Tableau bins.

Any ideas would be greatly appreciated!

Rob

• ###### 1. Re: Compare Two Histograms in Tableau 10 Desktop

Hi Rob,

Find my approach as reference below and stored in attached workbook version 10.0

a. I created bins \$10000 based on income

b. Defined a calculated field: Count Occupation: count([Occupation])

Dragged income(bin) and Gender to the Columns, Count Occupation to Rows and Gender once again in the Color-tile

1 of 1 people found this helpful
• ###### 2. Re: Compare Two Histograms in Tableau 10 Desktop

Norbert,

Awesome! Thank you for taking time to help me out. This is perfect. Much appreciated!!

Rob

• ###### 3. Re: Compare Two Histograms in Tableau 10 Desktop

Hi Rob,

Keep reaching out to the community with any challenge you have in the future.

Have a nice one:)

• ###### 4. Re: Compare Two Histograms in Tableau 10 Desktop

Rob,

Here are a few other variations on the theme based on Norbert's solution. One is shown below, there are a few others in the attached workbook.

The idea is that two histograms can sometimes be compared easily if they are overlaid somehow, as long as you are careful not to have one hide the other -- either using partial transparency or size.

There is another type of chart that is a bit more technical, but very useful for comparing two distributions called a Q-Q plot. That may not be the chart type to show to the CEO in a business presentation, but it can be very useful for an analyst comparing distributions to have a more precise characterization of the differences than comes from eyeballing nearby histograms.

Q-Q plots are described on wikipedia and in William Cleveland's excellent book Visualizing Data

1 of 1 people found this helpful
• ###### 5. Re: Compare Two Histograms in Tableau 10 Desktop

Alex,

Thank you! I like the continuous distribution. I am trying to open the attached file in Tableau Desktop 10 and getting a message that errors occurred while trying to load the file. If you have time to provide another file, I am intrigued to see the variations you created!

Rob

• ###### 6. Re: Compare Two Histograms in Tableau 10 Desktop

Alex,

No problem. Just needed to upgrade. Some great looks. Awesome. Thanks so much for sharing!

Rob

• ###### 7. Re: Compare Two Histograms in Tableau 10 Desktop

Alex,

I'm very close to having replicated the 4 views you created. Just a couple of gaps I can't pin down.

I'd be very grateful if you could tell me where I am off.

Rob

• ###### 8. Re: Compare Two Histograms in Tableau 10 Desktop

Rob,

You pretty much had it. On the first worksheet, you just needed to get the sort orders worked out so that the bars didn't hide the ones behind. For some reason, it seems you have to first edit the size legend and click the reverse checkbox, then Tableau turn on the automatic stacking of marks, so you have turn that off again via the analysis menu, then sort the Genders the way you like and finally go back to the size legend and turn off the reverse checkbox. I have no idea why you have to fuss around so much to get things arranged this way, but if you play with it enough you can usually get the settings you want to stick.

On the second worksheet, I just increased the transparency a bit. I didn't see anything else to change.

Best Regards,

Alex

1 of 1 people found this helpful
• ###### 9. Re: Compare Two Histograms in Tableau 10 Desktop

Alex,