While I am sure that dynamic sorting impacts the report, I use dynamic grouping on several groups to accomplish the complex sorts that my companies uses on it's reports. I create formulas, and for the most part the ones that work are the ones that take a parameter and then use existing fields in the dataset.
For example, I might have 3 levels of grouping, simply done they would be company, division, customer.....but based on parameters, it might be division, division, customer OR company, company, customer OR customer, company, division OR any other combination of factors. Why do fields repeat, well, you can't get rid of the group, and the sort applied to the group remains in effect, so the simplest solution is to replace the sort...
yes, now that DBlank mentions it, I am sure that there is overhead, but unless I want to build and MAINTAIN 12 reports that basically do the exact same thing except for the sorting it is the price that I am willing to pay.
Again, I might have 5 or 6 levels of dynamic grouping to accommodate the variations and twists and turns and subtotals. I have thought of late, as the company is moving to new reporting tool, to bring out the datasets already presorted/grouped which should speed the report a bit.
I am not sure what Pavan is trying to do, but given the current structure of the report, I am not sure that is doable. If you want to use a value from the subreport to group on, you need to run the subreport prior to the grouping, and then you would need to use shared variables to communicate which value you want to group on, and since it has been moved outside of the group header, it will now return more records that may not be what you want. Personally, I would try and move the retrieval of the dataset to a stored proc, add all the fields that would be in the subreport and get rid of the subreport, as this will 1 make the report run faster (fewer hits to the db) and allow you to group on a field that you want.
HTH