Contribution as a Column

Hi,

The report I am designing has following columns
1. Store Code
2. Sales in the store
3. Contribution of this store to the total.

The third column is derived. It is store sales devided by sum of sales of all the stores.
How do I define a variable for the third column so that the contribution value is calculated after the sum of Sales is calculated.
Thank you very much for your help..


Regards
JM
pjmohan's picture
10
Joined: Oct 1 2006 - 7:10pm
Last seen: 4 years 2 months ago

2 Answers:

The trick is put your expression in a textfield with evaluation time "Auto".

I.e.

new Double( $F{Store_Sales}.doubleValue() / $V{Total_of_Store_Sales}.doubleValue() )


JR will consider $F{Store_Sales} with evaluation time "now", and $V{Total_of_Store_Sales} with a different evaluation time (like group or report).

This is the only way to calc percentage values in JR.

Giulio
giulio's picture
74277
Joined: Jan 2 2007 - 4:15pm
Last seen: 1 week 23 hours ago
I have been trying with a varible. After giving expression in the field it worked.

Thank you very much
pjmohan's picture
10
Joined: Oct 1 2006 - 7:10pm
Last seen: 4 years 2 months ago
Feedback
randomness