title: Calculating sum of a column in a dataset
body: <p>I have the following query for a dataset:<br/></p>
  
  <pre class="lang-sql prettyprint-override"><code>select item, sum(salesAmount) as TotalSales from sales
  group by item
  order by TotalSales desc;
  </code></pre>
  
  <p>and I have set REPORT_COUNT&lt;=5 for limiting the data to 5 records only.</p>
  
  <p>Now I want to display top 5 items through a list component and their Sales Amount in percentage to that of the TotalSales amount of the top 5 items.</p>
  
  <p>I have tried to create a variable in the dataset as</p>
  
  <pre><code>sales_sum
  class: BigDecimal
  Calculation : Sum
  Reset Type : Report
  Increment Type : None
  Variable Expression : $F{TotalSales}
  </code></pre>
  
  <p>But the sales_sum increments with each row in the list. thus gives inaccurate value 
  for the percentage. What should I do?</p>