4 Replies Latest reply on Feb 14, 2013 1:09 AM by Jim Wahl

# can we fix the number of bins to be shown?

when producing frequency distribution chart, only the bins with non-zero percentage value will be shown.

Can we fix the total number of bins to show?

e.g. the bin size is 0.1 for values rangeing from 0 to 1. And I'd like to show 10 bins/bars in the frequency distribution chart, though some of the bars/bins will have zero values ...

May I ask how to do this?

Thanks!

• ###### 1. Re: can we fix the number of bins to be shown?

Have you tried selecting "Show Missing Values" on the (bin) pill?

See attached.

• ###### 2. Re: can we fix the number of bins to be shown?

Thanks, Jim! However, there seems to be a file missing in the zip package u attached.

Anyway, as shown in the tableau file attached, the bin size is 100k, and I want to show the percentage of the bin "100k" and maybe three more up to "1000k". It seems the "show missing values" is ticked on the bin pill ...

• ###### 3. Re: can we fix the number of bins to be shown?

Hi Joe,

Sorry, I think I misread your initial question (from your graph it looked like the 500K bin was missing, but I think the font was just difficult to read).

It sounds like the issue is that you want to set min and max values for your histogram, regardless of whether there is data in the smallest and largest bins. You want your graph to look like this:

To do this you need to control the x-axis, which is easy to do with a continuous variable (just edit axis, set range, set tick marks).

Therefore to create the "histogram" (really bar chart) above, I used Joe Mako's nifty formula:

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

Once you create the calculated field, move it to the dimensions shelf and add it to your view. Then select the pill and convert to continuous and edit the axis.

See attached.

Jim

P.S. Some might argue this isn't a histogram (there shouldn't be any space between the bars). If this bothers you, you might use a frequency polygon (i.e., line plot) which shows the same information with less ink.

1 of 1 people found this helpful
• ###### 4. Re: can we fix the number of bins to be shown?

Another trick you might find helpful is to make the [bin size] a parameter.

Then you can adjust the bin size "live" to determine the best size or see if the bins are obscuring a pattern. ...

1 of 1 people found this helpful