5 Replies Latest reply on Mar 24, 2017 9:37 AM by Jay Morehart

    Update suggested bin width based on filters

    Daniel Fenn



      Using Tableau 10.2, I'm trying to figure out how to filter data first, and then bin it for histogramming and have Tableau calculate the suggested bin width based on the filtered data rather than the original. I'm new to Tableau and more used to programming languages like Matlab or Python, so maybe my conceptualization of how this should work is wrong. If so, please  correct me.


      There are two ways that I'm trying to filter the data:


      (1) based on the numerical data range. The original data has a range from 0 - 900. This results in a suggested bin size of 23.7. When I add a filter to the data so that only the range 0 - 100 is used, the suggested bin size does not change, and there are too few bins. I tried adding the filter to the context, but to no effect. Is there an easy way to accomplish this?


      (2) based on a category field. I actually want to create two histograms from the data. Every row in my dataset corresponds to an entry that can belong to one of two categories. The category is given in one of the columns. I can drag the  category over to the "colors" box in the Marks area, and two histograms are created. This is what I want, except that I'd like the distributions to use different bin widths. In essence, I'd like to filter by category and then calculate bin widths separately on each category.


      I should add on point (2) that I'm displaying the distributions as lines, so there's no concern about the boxes not lining up for distributions using differing bin widths.


      I'd appreciate any direction anyone could give me on how to do this.


      Thanks in advance,