title: Crystal Reports - Sum of columns in a group
body: <p>So I have created the following code snippet to run in a formula to rummate the hours worked for each code in labor... </p>
  
  <pre><code>NumberVar totalHours := SUM({LaborTicket.HoursWorked}, {LaborTicket.VisualCode});
  NumberVar totalMinutes := SUM({LaborTicket.HoursWorked}, {LaborTicket.VisualCode}) * 60 MOD 60;
  NumberVar totalSeconds := SUM({LaborTicket.HoursWorked}, {LaborTicket.VisualCode}) * 3600 MOD 60;
  
  ToText(totalHours, 0) + ":" +
  ToText(totalMinutes, '00') + ":" + 
  Totext (totalSeconds , '00' )
  </code></pre>
  
  <p>It converts my representation of 1.50 hours into 1 hour and 30 minutes (or 1:30:00), beautiful.</p>
  
  <p>Now however, they want the report to be by client, by visual code...</p>
  
  <p>Since I need to show total hours for each visual code on one group footer and totals for each client on another group footer, I need to be able to specify to summate based on both of those facts which I'm not sure how to do.</p>
  
  <p>The above function summates ALL clients, not just the one at that point in the report so I need to be able to summate based on the visual code AND client name.  Any suggestions?</p>
  
  <p>I'm using the version of crystal that comes with Visual Studio 2010 (well the one you download after installing it)</p>