3 Replies Latest reply on Aug 13, 2013 5:39 PM by Patricia Schmuhl

# Creating average and binned data with count distinct

I am new to Tableau but have a large survey dataset with multiple responses for survey questions. I have created an extract and am using the Count Distinct function to do my histograms and frequencies. However now I want to find the average age but of course the average age is based on the number of rows in the dataset and not the number of distinct rows. So how do I use count distinct function to created an average. I would also like to bin some of my measures in making a histogram but don't appear to be able to using count distinct. If someone could point me in the right direction would be a great help. Thanks.

• ###### 1. Re: Creating average and binned data with count distinct

Hi Mark,

Could you post some sample data in a packaged workbook? There are a variety of ways to get at this kind of calculation in Tableau, and the exact calculations are dependent on how the data is organized.

As far as binning measures, Tableau is only able to use its built-in bin functions on non-aggregated measures. You can effectively create bins based on aggregated measures by setting the aggregated measure to be discrete in the view (clicking on the pill, and setting it to be discrete, which changes the pill from green to blue). This causes Tableau to draw headers for the values of pill instead of axes. This won't get you an exact histogram, but you can play with the width of the bars to get pretty close.

FYI, Steve Wexler has written a great series of posts on working with survey data in Tableau, this one is a good place to start: http://www.datarevelations.com/using-tableau-to-visualize-survey-data-part-1.html

Jonathan

1 of 1 people found this helpful
• ###### 2. Re: Creating average and binned data with count distinct

Thanks Jonathan I managed to figure it out in the end. The posts you provided on analysis of survey data was really helpful. Thanks again

• ###### 3. Re: Creating average and binned data with count distinct

Can you share your answer to this question?? How do I average the unique rows of a scored survey?? It is averaging every row.

Thank you.