title: Top N of calculated field in Crystal reports
body: <p>I have a dataset that tracks miles driven and fuel used for a fleet of cars over a 3 month period. The data comes through like so: The bold text is the group level. Left to right the fields are: EQ#, Make/Model, Department, Avg MPG, Make/Model MPG (Fleetwide), Variance of average MPG against the Fleet avg MPG.</p>
  
  <p>In the details, you can see one entry per month for the same vehicle.</p>
  
  <p><a href="https://i.stack.imgur.com/Oyfd6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Oyfd6.jpg" alt="enter image description here"></a></p>
  
  <p>The "Make/Model Avg MPG" is a static number. The "Variance" is the calculated field: MPG - Make/Model Avg MPG. </p>
  
  <p>Currently, I have the report grouped by equipment number so I can get the average MPG over the 3 month period. What I want to do is show the 5 least most efficient vehicles. However, I cannot sort on the calculated field. If I do it at the detail level, I can sort them that way no problem to get the Bottom N, but then I can't account for the average MPG of each vehicle for a three month period.</p>
  
  <p>I have looked hard for an answer to this and I seem to keep hearing that Crystal cannot sort on calculated fields at the group level. I need help finding a work-around that will get me to this result.</p>