title: Print When Expression to print only the last element in the group
body: <p>I have following data set in oracle table and want to generate CSV file from that data. </p>
  
  <h2>My data</h2>
  
  <pre>
  CaseID  Amount
  1000     10
  1000     20
  1000     50      
  2000     30 
  2000     10     
  3000     30 
  3000     20 
  3000     20   
  </pre>
  
  <p>It is necessary to show the following output from above data. </p>
  
  <h2>Required Output</h2>
  
  <pre>
  CaseID  Amount  Aggregate
  1000     10
  1000     20
  1000     50      80
  
  2000     30 
  2000     10      40
  
  3000     30 
  3000     20 
  3000     20      70
  </pre>
  
  <p>Aggregate column is populated by accumulating the sum of Amount according to caseID group.</p>
  
  <p>Group summary should display on last element of the group. But not in the next row, should display in the same row and next column, that matching with the last element.   </p>
  
  <p>I tried with 'Print When Expression' for other scenarios, but unable to use with this scenario. Also I have find similar questions, but not cater with this requirement. So would like to know the possible solutions for this. </p>