Sorting after grouping

I have a lookup field pointing to names (first name, last name). I also have a field that just has last name. I would like to group by name (first name, last name), but sort by last name. I am able to group by name, but I can’t then sort by last name. What am I missing?