KNOWLEDGE BASE

How to fix The Number of Bins Despite of Changing Filter


Published: 11 Mar 2022
Last Modified Date: 13 Mar 2022

Question

How to fix the number of bins despite of changing filter.

Environment

Tableau Desktop

Answer

1. Create parameter [Number of bins]
User-added image

2. Create parameter [Bin size]
User-added image

3. Create parameter [Category]
User-added image

4. Create parameter [Filter]
User-added image

5. Create calculation field [Bin size]
 
({ FIXED [Category]:MAX([Profit])}-{ FIXED [Category]:MIN([Profit])})/[Number of bins]

6. Create calculation field [Apply button]
 
'Apply'

7. Create calculation field [Apply button filter]

[Parameters].[Category]=[Category]

8. Create calculation field [Filter]

[Parameters].[Filter]=[Category]

9. Add [Filter] to Filters in histogram, select [True]

10. Right click on the bin > Edit...

11. Set [Bin size] as Size of bins 

12. Create new worksheet [Apply button]
  • Drag [Category] and [Bin size] to Detail
  • Drag [Apply button] to Text
  • Drag [Apply button filter] to Filters, select [True]
  • Hide Tooltip
13. Create new dashboard and add histogram and apply button worksheet

14. Create following parameter actions
User-added image
User-added image

15. Use [Category] parameter to change filter and Click 'Apply' after selecting filter item and setting number of bins
Did this article resolve the issue?