Multi index aggregations

I don't know if this is exactly your problem but it's the same context.