title: Crystal reports conditional summary
body: <p>I am trying to create a conditional summary in a Crystal Report using invoice data where if an item code appears more than once on the invoice, only include the amount in the total once, and for the greatest amount. I also want this reflected in the number of items, eg if there are 4 items but two are the same item code, then the nbr of items for the invoice should be 3. Here is a sample of the data:</p>
  
  <pre><code>TDate   Invoice ID  Fee line    Item Code   Nbr Items   Amount
   05/01/2017 12024200    11425100||11    11610   1   54.20
   05/01/2017 12024200    11425100||12    55238   1   156.25
   05/01/2017 12024200    11425100||13    55238   1   96.60
   05/01/2017 12024200    11425100||15    55276   1   80.55
  </code></pre>
  
  <p>So the totals for Invoice 12024200 should look like this (ignore the values for the second occurrence of Item Code 55238).</p>
  
  <pre><code> 05/01/2017 12024200    11425100||11    11610   1   54.20
   05/01/2017 12024200    11425100||12    55238   1   156.25
   05/01/2017 12024200    11425100||13    55238   1   96.60
   05/01/2017 12024200    11425100||15    55276   1   80.55
   Total                                          3  291.00
  </code></pre>