Jump to content

sum is multiplied by variable position?


ggovedar

Recommended Posts

I know the following is really to long, but please bear with me....

 

I’m developing a report with two groups

 

Group 1 – broker

Group2 – product

 

It’s a YTD report so in the column header I have 200701, 200702, 200703…

 

My date looks something like this

 

Broker_name Month Product Value

Broker 1 2007January a 100

Broker1 2007JFebruary b 50

Broker1 2007JMarch b 50

Broker2 2007January a 10

Broker2 2007February a 10

 

 

I need to show sums by broker by product by month

 

In product group footer I’ have a variable summing up all values by broker/product as this

Variable name sumJan

 

new Double (($F{Month}.equals("2007January") ? $F{Value}.doubleValue() : 0.00 ))

 

calculation type: sum

rest type: group

reset group: product

 

this all works fine and I get correct sum per broker/per product

 

Broker Name Product 200701 200702 200703….

Broker 1 a 100 0 0

b 0 50 50

TOTAL 100 100 150

Broker2 a 10 10 0

TOTAL 10 20 0

 

 

The problem comes when I try and sum by product by month, the sums seem to be MULTIPLIED by what seems the position of declared sum variable..more or less

 

So for broker 1 I’ll get 100 in the sum for 200702, and 150 for 200703 in this variable..the… multiplication number seems to go up for each month so for May it is what actuall sum for that month should be multiplied by 5….

 

Variable name: sum_sum_jan

 

$V{sum_jan}

 

calculation type: sum

rest type: group

reset group: broker

 

 

It seems to me like there is a loop that adds all the fields together an by the time it gets to for example May it has already added all the values 4 times, so I end up with the total 5 times more than it should be…

 

I hope this makes sense..

Anyone has any idea how can I stop this from happening??

 

Thanks in advance

 

Goran

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...