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,
Bins.twbx 15.5 KB
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.
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 email@example.com .
You should include my workbook with an example of the Tableau created bin that suffers from the range issue issue in the workbook.