1 Reply Latest reply on Feb 12, 2016 4:40 AM by Yuriy Fal

# Histogram with distinct counts of number of values in bins

Hi there everyone,

I have read through about 50 articles but just cant seem to find a solution to this problem.  I have a data set that is structured as such:

 Year ID Section Unit Valueq 2014 1093 Section1 Unit 1 49358.05 2014 1093 Section1 Unit 2 88704.95 2014 82 Section2 Unit 1 41902.74 2014 82 Section2 Unit 2 55908.12 2014 82 Section2 Unit 3 37632.93 2014 274 Section1 Unit 1 55134.38 2014 274 Section1 Unit 2 97290.93 2014 274 Section1 Unit 3 51308.23 2014 630 Section2 Unit 1 56812.79 2014 630 Section2 Unit 2 77500.36 2014 630 Section2 Unit 3 42349.07 2014 1076 Section1 Unit 1 48429.36 2014 1076 Section1 Unit 2 70115.02 2014 1076 Section1 Unit 3 40153.74 2014 31 Section2 Unit 1 53610.93

I am trying to create a histogram that counts the distinct number of IDs that have a value that is broken out by the value table.  For example:  My x axis will have bins for 10k, 20k, 30k, 40k, etc and I want the bars to display on the Y axis the count of the number of IDs that have values that fall within these bins.  I need the Section and Unit Dat for further analysis.  My problem is that I can drill down and create views and filter by year and section and unit and get the right count, but even when I use Count Distinct on the IDs I am still getting numbers that are way out of whack.  I looks like it is counting each combination as a distinct value.  Yes I have done an extract for it.  The source is an Excel spreadsheet.

Attached is a sample workbook with mocked up data.  Any help that could be given on this issue would be much appreciated.

Thanks.

• ###### 1. Re: Histogram with distinct counts of number of values in bins

Hi Robert,

You're right, Tableau defines a view granularity

(and the number of Marks to draw on canvas)

from all unique value combinations

of all Dimension pills on a view.

[Valueq (bin)] is a Dimension, too (though a special one).

So if one place both [ID] and [Valueq (bin)] on a view (Sheet 7)

and filter [Year] = 2013, the number of Marks on a view would be 350 --

each Mark is a combination of unique values of [ID] and [Valueq (bin)].

The aggregation COUNTD([ID]) is calculated for each Mark.

So your 164 unique IDs are counted in one or more Marks --

same ID, different Valueq (bin). When other dimensions on a view --

Marks are drawn different, so distinct IDs are counted different.

I couldn't find a problem here.