1 2 Previous Next 17 Replies Latest reply on Jun 9, 2016 11:07 AM by Jerrad Pierce

Hello all,

I am trying to figure out how to adjust the x-axis for a histogram. I need the histogram to have particular sized bins and specific minimum value in order for bins to align correctly with a threshold value that I will be overlaying on the chart. In this case, I need to distinguish between cases that are less than 115% and greater than 115%. Therefore I have set my bin size to 0.15 and need the x-axis to start at 0.25 so that the math works out. There are no cases with values < 25%.

Thanks!

• ###### 1. Re: Adjust histogram axis

Have you tried creating a bin based on the measure you are trying to histogram? Once the bin is created you have options to set the size of each bin. Feel free to attach a packaged workbook as well so I and others can have a closer look to help out.

• ###### 2. Re: Adjust histogram axis

Yes, and Tableau insists on starting at the minimum value of the measure being charted. I'll try to setup an sufficiently abstract and workable extract...

• ###### 3. Re: Adjust histogram axis

Example posted

• ###### 4. Re: Adjust histogram axis

Got the file. Just starting to look at it but want to confirm 2 things:

1. You are OK with the bin size (.15), but you want the x-axis to have a minimum value of .25? Right now the min value is .30

2. You have sum(values) listed in the row shelf. Would that be better to have count?

• ###### 5. Re: Adjust histogram axis

1. Not just okay, require. 1.15 mod 0.15 gives 0.10. Therefore 0.25 is the minimum needed to include the smallest value in the data set, and have properly aligned bins.

2. Aye, I neglected to change it form the default SUM to COUNT for the example, doesn't really affect the question though :-P

• ###### 6. Re: Adjust histogram axis

OK. I'll take a look but doesn't look good. I also want to confirm - the data set provided, the lowest value is ".449888" which falls into the .30 bin (values of .30-.4499999). So currently there isn't a low value of .25-.29999. Are you saying that .25 is a potential value, and that because of it's potential, you want .25 bin always listed in the graph?

also...do you have any issues with a max bin being visible? Sorry for all the clarifying questions......

• ###### 7. Re: Adjust histogram axis

No worries, it's an odd requirement.

I am not concerned whether or not there are values in any given bin, just with bin alignment. My threshold is 1.15, and I cannot have that fall in the middle of a bin. The way to insure that seems to be to set a minimum (not sure how) and a bin size.

No problems with max.

• ###### 8. Re: Adjust histogram axis

So I think I have the concept that you will need, but I'm having difficulties executing it. A continuous bin will allow you to see all bins, even if null.

Display of null bins in histograms

Calculate Bins for use with continuous axis

The one issue with that 2nd link is that it assumes your bin interval is integer, not float (.15). I tried changing the values by taking [Values]*100 to make it an integer and then setting the bin size to 15. File is attached.

• ###### 9. Re: Adjust histogram axis

I came across those articles in my search, but they didn't seem to help.

I'm seeing the same histogram as I did before, but the idea of rescaling the inputs is interesting. Unfortunately it doesn't change the outcome :-/

• ###### 10. Re: Adjust histogram axis

Do you not see this?

• ###### 11. Re: Adjust histogram axis

No, I don't, but that would work for me. How'd you do it?

• ###### 12. Re: Adjust histogram axis

First, check my previous reply. I attached a workbook "HistogramAxis_edit.twbx." That should have the changes I made so you can see. If not here are the calculated fields I created:

1) New Measure: [Values2] = [Values]*100 (again, to scale so we don't have decimals)

2) New Parameter (this is optional): Bin Size, as detailed:

3) New Dimension: [Calc Bin] =

if [Values2]>=0 then

DIV(int([Values2]-[Values2]%1),[Bin Size])*[Bin Size]

else

DIV(int([Values2]+[Values2]%1),[Bin Size])*[Bin Size]-[Bin Size]

end

If you don't need a parameter to let people choose a bin size, you can skip #2 and change #3 (replace Bin Size with 15).

When you put [Calc Bin] on the column shelf, change it to continuous and then edit the x-axis as follows:

Hope this helps.

1 of 1 people found this helpful
• ###### 13. Re: Adjust histogram axis

Sorry if I wasn't clear. When I said, "I'm seeing the same histogram as I did before" that referred to the loading the worksheet you attached (below).

The closest I can get to what you've demonstrated using your procedure is below, the instant I convert it to a histogram the axis resets:

• ###### 14. Re: Adjust histogram axis

I'm trying to attach the updated edited workbook again! I edited the file in v9.3 if that makes a difference.

1 2 Previous Next