Bug 146967 Total fuction with result of the aggregate on group-Level should be enhanced
Description: Now if we want to do total fuction with the Aggregate result on the group level, it cant be fulfilled. For example, we set a total.sum() aggregate on a group level first, and then we sum the result of total.sum() again. The expected result should simply equal to sum over all rows. But the actual result is not as our requirement. I attached the design file as the example. Expected result: The aggregation on the group total should be enhanced, or we cant get expected result such as the requirement that total.rank() with the average result on the group level and so on.
data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/expression/AbstractExpressionCompiler.java
if ( agg == null )
		{
			
			
			
			throw new DataException( ResourceConstants.INVALID_TOTAL_NAME,
					aggrFuncName );
		}
		return agg;
	}
	/**
	 * flatten out the tree when there are nested ComplexExpressions ( i.e.
	 * ComplexExpression with ComplexExpressions as sub expressions ) the
	 * nesting provides no additional information for the calculation to use.
	 * this nesting could occur depending on the Rhino parse tree that's
	 * returned by Rhino, and the limited way we can traverse down the parse
	 * tree.
	 * 
	 * @param complexExpr
	 */
	private void flattenNestedComplexExprs( ComplexExpression complexExpr )
	{
		ArrayList interestingSubExpr = new ArrayList();
		ArrayList interestingConstantExpr = new ArrayList();
		Collection subExprs = complexExpr.getSubExpressions();
		Iterator iter = subExprs.iterator();
		while( iter.hasNext() )
		{
			CompiledExpression childExpr = (CompiledExpression) iter.next();
			if( childExpr instanceof ColumnReferenceExpression ||