I am trying to build a report of the following format:
Some Column A | Some Column B | Some Column C | Percentage Allocation
-------------------------------------------------------------
Value N | Value B | 100 | 10%
Value C | Value S | 200 | 20%
Value D | Value Y | 300 | 30%
Value A | Value X | 400 | 40%
-------------------------------------------------------------
| 1000 |
The Percentage_Allocation
column should be calculated like this: 100/1000 * 100
I have created two variables:
GRAND_TOTAL
defined as the sum of the values in Column C
and PERCENT_ALLOCATION
defined as Field value of Column C divided by GRAND_TOTAL
The output I get is:
Some Column A | Some Column B | Some Column C | Percentage Allocation
-------------------------------------------------------------
Value N | Value B | 100 | 100%
Value C | Value S | 200 | 66%
Value D | Value Y | 300 | 50%
Value A | Value X | 400 | 40%
-------------------------------------------------------------
| 1000 |
I understand that this is happening because the value of PERCENT_ALLOCATION
is being calculated as and when a new row is created on the report. But I want it to be calculated only when all the details have been loaded. Maybe this is not possible? I don't know, is there something I can do to achieve my target output?
UPDATE:
So I've figured out that there's a property called Evaluation Time
which can help me decide when the column PERCENT_ALLOCATION
should be calculated. I have set it to Report
so that the value of GRAND_TOTAL
takes the sum of all the values in Column C
. But now I find that PERCENT_ALLOCATION
is being calculated using the last value in Column C
only. So my report looks like this:
Some Column A | Some Column B | Some Column C | Percentage Allocation
-------------------------------------------------------------
Value N | Value B | 100 | 40%
Value C | Value S | 200 | 40%
Value D | Value Y | 300 | 40%
Value A | Value X | 400 | 40%
-------------------------------------------------------------
| 1000 |
Thanks.