3 Replies Latest reply on Apr 5, 2013 1:15 AM by Jim Wahl

    Custom bin sizes for histograms

    Tom Smith

      Hi all - I'm trying to create numerous histograms (based on different measures) that all share the same bin distribution.

       

      I know there are a couple posts here regarding this, but none seem to help with the above problem. All the suggestions I've seen relate to creating bins based on a measure, however, in my case I have multiple measures but want to share the same bin size.

       

      Is there any way to do this in tableau. Seems simple, but it's pretty complex for some reason in tableau.

       

      Here is an example:

       

      Measure 1 has the following data: 1,1,1,2,2,3,4,5,5,6,6

      Measure 2 has the following data: 2,2,3,4,4,4,5,5,5,5

       

      As you can see, measure 2 does not include '1' or '6' but I still want hose to show up as bins in the histogram.

       

      Thanks

        • 1. Re: Custom bin sizes for histograms
          Jim Wahl

          Hi Tom,

           

          You might try creating your own bins with the below formula, which will allow you to make them continuous, which allows you to set the axis range manually to, for example, show "6" even if it's not in the data.

          INT([Value]/[Bin Size])*[Bin Size]-IIF([Value]<0,[Bin Size],0)

           

          See Joe Mako's description here.

          http://community.tableau.com/docs/DOC-1353

           

          Here's another post with a similar question as yours: 

          Re: can we fix the number of bins to be shown?

           

          In Tableau, I've only created histograms for a handful of measures at a time, where the manual process is fine.

           

          If you have lots of measures that you'd like to histogram, I'm not sure how you can automate this. If it's only for your personal analysis, I'd probably use another tool like R, where this is one or two lines of code. ...

           

          Jim

          1 of 1 people found this helpful
          • 2. Re: Custom bin sizes for histograms
            Tom Smith

            Thanks for your reply. I've resorted to R because this is just too much of a hassle to make it look the way I want in Tableau .

            • 3. Re: Custom bin sizes for histograms
              Jim Wahl

              Just another thought, perhaps for future reference, you could reshape the data so that all of the measures are in a single Measure Label column with their values in a second column.

               

              Now you can use Tableau's binning on the second column (or calculate the bins yourself), add the resulting bin field to Columns, Number of Records to Rows and then add the Measure Label to Rows.Now you'll have rows of histograms for each measure.

               

              Jim