correct. a SUM is A sum of all rows (not just displayed).
You can use Running Totals or Shared Variables to get the values you want.
I prefer RT's (most other seem to prefer shared variables).
Especially if you need to display the data on multiple grouping levels I prefer RT's as you can use one per value vs. 3 per value as a shared variable.
The RT version of MIles for grouplevel 1 is
name=GL1_miles (or whatever)
field to summarize=Miles
evaluate=on change of a group (routeid)
reset= on change of group (select group level 1)
place in Group level 1 footer
Neither a shared variable nor a RT work in a Group header