2 Replies Latest reply on Sep 26, 2016 9:05 AM by T B

    Hide a bar in bar chart when a filter renders the sample size too low?

    T B

      Hi, I'm a Tableau noob and am really impressed by the support community! I am trying to hide/obscure data when a user-selected filter causes the sample size to fall below N results.


      The below viz (workbook attached) is a fictitious breakout of "CEO Compensation Type" (cash, stock, or cash/stock combo) for Fortune 100 firms year-over-year. Clicking on it will take you to the Tableau Public site where you can see the filters; not sure why they don't show up here.


      I'm trying to create a function that, when a filter causes the sample size within a particular year (or within the worksheet as a whole, if easier) to fall below 10 data points, that year (or worksheet) shows up with a message saying "Please select a filter that results in a larger sample size."


      You can do it below by selecting only US Private Equity in the viz filter. Doing so drops the sample size significantly. Is there a way to cause each column (or the whole worksheet) to be obscured by a message because it has less than 10 data points?


      I originally tried creating a calculated field with:

      If SIZE() < 10 THEN "Too granular" ELSE "Okay" END

      And using it as a filter, but nope.


      Any help would be much appreciated. Thanks!!


      NOTE: the correct answer is below from Andrew. FYI for anyone else attempting to do this -- to make the filter work properly across multiple worksheets, I had to go into the Filter shelf in each worksheet and set "Compute Using" to the dimension the worksheet is based on (in the CEO example, the dimension was "CEO Compensation Type"). This hides any column without a sample size meeting the threshold (here, 10). The default is "Table (across)", which can have unintended effects.