title: SSRS: How to make a sum that only includes the last item in a group
body: <p>I have an rdlc report file, and I am trying to make a sum which can only include the last item in each group. I have a table kind of like this:</p>
  
  <pre><code>Place                 = ?                              (Group header 1)
      User              = ?                              (Group header 2)
          Date          =Last(Fields!Number.Value)       (Group header 3)
              Number    =Fields!Number.Value             (Detail row)
  </code></pre>
  
  <p>So, in other words, in <code>User</code> there, I want a sum of <code>Date</code>... if that made sense... </p>
  
  <p>The <code>Number</code>rows contain many numbers per <code>Date</code>. But <code>Date</code> shows only the last number for that day, because the rest doesn't count (but must be displayed) In <code>User</code> I want to sum up those last numbers for all the dates for that user. And same with <code>Place</code> (which would be the sum of every last number for every day for every user).</p>
  
  <p>Could anyone help me with this? I tried the obvious (to me at least) <code>=Sum(Last(Fields!Number.Value))</code>, but (also tried to specify the group in those functions, but didn't make a difference because) I get an error when I try to compile which says: </p>
  
  <blockquote>
    <p>The Value expression for the textbox 'numberTextbox' contains an aggregate function (or RunningValue or RowNumber functions) in the argument to another aggregate function (or RunningValue).  Aggregate functions cannot be nested inside other aggregate functions.</p>
  </blockquote>
  
  <p>Which I guess kind of makes sense... but how do I do this then?</p>
  
  <hr>
  
  <p><strong>Update:</strong> I have solved the issue by adding another column, and copying those last numbers into that column. This way I can display all the numbers, and do the summing on the column that only contains the ones that is going to be in the sum. I am still very curious to if anyone have a solution to my original problem though... so please post an answer if you do! </p>