Alexander,
I don't know if this will help, but I've had the same requirements and that's how I accomplished it. I knew the report would have 2 groupings, but they could be any two groups, so I created two generic group key definitions. Maybe there are other ways to do it, but it worked for me, so I never really investigated any other method.
Kevin