3 Replies Latest reply on Jan 9, 2014 12:44 PM by Dan Huff

    Minimum value used for bin error

    Amanda Widmaier

      I've read as many discussions about binning and have not seen an answer to this following issue I am having with binning.

      I have a measure that I'd like to bin and the data ranges from 4.1% to 13.9%. I'd like to create bins that are of size 1.96% to have exactly 5 bins (with unequal about of records in each). When I put this (or any) value into 'size of bin'' the resulting bins start at a value less than the minimum value for this measure. In this example Tableau creates the first bin to start at 3.9% instead of 4.1%. This is misleading that the data begins at 3.9% instead of 4.1%. Is there a way to fix this without a calculated field? If not, how would I create the calculated field in a dynamic enough way so that I do not have to figure out the minimum value for each of the 5 bins?

        • 1. Re: Minimum value used for bin error
          Dan Huff

          Amanda--

           

          You could do something like the following:

           

          str(4.1 + ( int( ( [Data] - 4.1 ) / 1.96 ) * 1.96)) + "% to " + str(1.96 + (4.1 + ( int( ( [Data] - 4.1 ) / 1.96 ) * 1.96))) + "%"

           

          See the attached for what the final solution looks like. I just went with numbers ranging from 4.1 to 13.9 because I was not sure how your data is stored. You will just have to adjust the magnitude of the numbers above if your data is stored as decimals.

           

          I hope this helps,

           

          Dan

          • 2. Re: Minimum value used for bin error
            Amanda Widmaier

            Thank you. This is helpful;  however, it seems strange that I have to do this manually when I thought this was the function of binning in the first place if the user knows the bin size they want. What is the reason behind the binning function that produces a bin that starts outside the range of data? When I bin the dataset you provided the same thing happens.

            • 3. Re: Minimum value used for bin error
              Dan Huff

              To be honest I rarely use the bin feature in my own workbooks because I usually make unequally sized bins so I am very used to writing calculations like the above. There may well be a reason for how and why we determine that the bin should include padding on both ends of the range.

               

              It is admittedly strange. You could always open a support case saying that this behavior is hurting your work flow and you would like to know why it is happening. Somebody on our Support team may know more than I in regards to how binning specifically works. You can do this by simply emailing support@tableausoftware.com .

               

              You should include my workbook with an example of the Tableau created bin that suffers from the range issue issue in the workbook.

               

              Thanks,

               

              Dan