Say you have a jasper report, the you have grouped twice,
You raw SQL data looks like
Description, Line_Group, Line_Total, Grand_Group_Total
And you want to get the total sum of Grand_Group_Total.
Create a variable with the following:
Calculation: Sum
Increment Type: Group
Increment Group: Line_Group
If this is nest again into another group, you can in the variable set
Reset Type: Group
Reset Group: Name of top level group.
Feel free to comment to get some more specific help