title: How to exclude null values in table calculation in Tableau?
body: <p>I'm trying to present a cohort analysis in Tableau. The dimensions are the first month a visitor arrived and the age of a cohort, and the measure is the number of visitors. I'd like to show the percentage retained from the first month of each cohort over each cohort. My problem is that when I do a table calculation to calculate the percent difference Tableau treats null values as 0, so it incorrectly shows -100% loss for the lower half of the table.</p>
  
  <p>So for example this:</p>
  
  <pre><code>     | 0   | 1    | 2  
  
  May  | 100 | 90   | 80 
  
  June | 200 | 170  | null
  
  July | 300 | null | null   
  </code></pre>
  
  <p>Turns into this when I do a percentage difference table calculation with respect to the first value in each row:</p>
  
  <pre><code>     | 0   | 1    | 2  
  
  May  | 0%  | -10%   | -20% 
  
  June | 0%  | -30%   | -100%
  
  July | 0%  | -100%  | -100%   
  </code></pre>
  
  <p>But I would expect that all the cells with <code>-100%</code> should actually be null. </p>
  
  <p>Is there a way to make Tableau correctly deal with the null values so that nothing is displayed in the lower half of the table instead of <code>-100%</code>?</p>