title: Tableau, cannot further aggregate
body: <p>Reading this tutorial on <a href="https://public.tableau.com/s/blog/2013/11/fitting-normal-curve-histogram" rel="nofollow noreferrer">creating normal curve on Tableau</a></p>
  
  <p>I am trying to create Standard Deviation calculated field for Average Ratings of each Location (Average rating is written on heat map):</p>
  
  <p><a href="https://i.stack.imgur.com/fUfpN.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fUfpN.gif" alt="enter image description here"></a></p>
  
  <p>Creating the mean was easy, because I already have following:</p>
  
  <pre><code>Mean = Total(AVG([Number_Rating]))
  </code></pre>
  
  <p>And I can create standard deviation</p>
  
  <pre><code>St Dev = TOTAL ( STDEV ( [Number_Rating] ) )
  </code></pre>
  
  <p>But I have difficulty creating curve</p>
  
  <pre><code>Curve = (1/(sqrt([St Dev]^2*2*pi()))) * exp(-( (attr([Rating Bin Size])-[Mean])^2  /  (2*[St Dev]^2)  )) 
  * [Rating Bin Size]
  * TOTAL(SUM([Occurrence_Location]))
  </code></pre>
  
  <p>Occurrence_Location is the number of Locations, i.e. <code>CountD([Location])</code>. Error is </p>
  
  <pre><code>Argument to SUM (an aggregate function) is already an aggregation, and cannot be further aggregated.
  </code></pre>
  
  <p>How to fix this? Workbook on <a href="https://public.tableau.com/profile/sonihal#!/vizhome/BellCurveBusinessRating/Grade" rel="nofollow noreferrer">Public Tableau</a>, tab of interest is <code>Grade</code> and <code>Histogram</code></p>