Sort repeating group by a linked child element

Does this help at all?

I’ve run into a similar situation and resolved it by doing this: (callen.hedglen’s comment)

It’s a slightly different situation though so may not work. I’m too tired right now to think about any further ideas but I can think about it again tomorrow if you’re still stuck.