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

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

## 2 Answers:

Posted on October 3, 2006 at 6:22am

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

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