Over on the Tableau forums Alexander Mou answered a thread on generating a count from sparse data, and the solution he came up with is found in his blog post Dynamic Histogram Over Time. In this post I’m diving into some details of what Alexander did, coming up with a couple of alternative remixes of that solution, and describing a couple of different ways to effectively partition a table calculation via another table calculation. Read on for details!
Easy bin building:
– select a measure
– click on Show Me!
– pick the histogram
Tableau tries to create roughly 10 bins, adds a dimension for the bin to the dimensions list
can change bin size
Alternate for Bins (allows for reference lines on a histogram):
– Create a calculated field such as: INT([Sales]/100)*100-IIF([Sales]<0,100,0)
– Put Number of Records on Columns, calculated field on rows.
– Then can have calculated fields like: TOTAL(AVG([Sales])), TOTAL(MEDIAN([Sales])), etc.
– Will need to set Compute using to the calculated field.
Some stuff on bins & blends (might need this to pull off getting the percentile)
From Joe Mako:
BYO Bin calc:
INT([Value]/[Bin Size])*[Bin Size]-IIF([Value]<0,[Bin Size],0)
Manually choosing the number of bins/binning a dimension by a measure: