arceliza Posted November 21, 2007 Share Posted November 21, 2007 Re: Summation by groupHere’s the scenario: Items A B C D E F GGroup1 I1 1 2 4 2 0.10 2.00 0.20I2 2 2 4 4 0.20 2.00 0.40Totals 8 6 0.60 Group2 I3 3 2 2 6 0.30 1.00 0.30I4 4 2 1 8 0.40 0.50 0.20Totals 3 14 0.50 Given:A, B & C Computation:D = A * BE = D / SUM [D]F = C / B G = E * F = new Double( (($F{A}.doubleValue() * $F{B}.doubleValue()) / $V{SUM_G}.doubleValue()) The summation for C & D didn't have a problem since I directly get the fields. I had a problem getting the summation for G per group since it involves computation with summation of overall totals for D. It gives a different result. I added a new variable (SUM_G) which has a class type of java.lang.Double and calculation type is Sum. Its reset type is Group and the reset group is the group I added. Does it have something to do with the evaluation time of the variable? How can I get the correct result? Thanks Link to comment Share on other sites More sharing options...
arceliza Posted November 21, 2007 Author Share Posted November 21, 2007 Here’s the scenario: Items A B C D E F GGroup1 I1 1 2 4 2 0.10 2.00 0.20I2 2 2 4 4 0.20 2.00 0.40Totals 8 6 0.60 Group2 I3 3 2 2 6 0.30 1.00 0.30I4 4 2 1 8 0.40 0.50 0.20Totals 3 14 0.50 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now