[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.birt] Re: how to make sum of percentile = 100

Alessio,

In you example what should be the total value?

Jason

Alessio Lai wrote:
Jason Weathersby wrote:

Alessio,

Can you not just modify the sum expression to round or fixed decimal digits?
ie

xyz = 99.99;
xyz.toFixed(0);

Jason


Alessio Lai wrote:
Hello to all ,
I'm a new Birt user and I'm trying to do a report which display financial analysis with a crosstab and a datacube.


There is a column that shows percentiles of a quantity .
I have created a group whith in the total sum is the sum of the percentiles.
In many cases the total sum is 100 ,
in a few cases , cause the approximation to two decimal digits , the sum is 99.99.
To solve this , I have to add 0.01 to the last percentile row of the group ,


Do you know how can I do that ??
I guess with javascript for example ...
I wonder if there is a function like

data["percentile"].getLastRow().value ,

so I can adjust the last percentile doing this:
data["percentile"].getLastRow().value =data["percentile"].getLastRow().value+0.01



Hope I well explained the problem .

Many thanks ,

Alessio


Jason , many thanks for the reply , and I apologize for resurrecting a dead thread but I've already setted up the sum of singles percentiles = 100 , by literally doing a compColumn.setExpression(100) in the total.


What I'm trying to achieve is , supposing that I have a table similar to this :

              Data1        Perc

         148.960,00        1,31
       2.985.200,00        26,32
         247.520,00        2,18
       4.270.560,00        37,65
       1.328.320,00        11,71
       2.360.960,00        20,82

Tot:   11.341.520,00        100


Here's a real example of a report generated from me. Perc column is a ComputedColumn with an expression setted up of this kind :

Finance.percent(data["Data1"],data["Data1_Group/LEV1"]); (where Data1_Group/LEV1 is defined as the sum of Data1's data.)

The tot value of column Perc isn't calculated as the sum of the singles percentiles , but is setted directly to 100.
The problem is that the sum of the single percentiles isn't 100 but 99.99 In other cases 100.01 .
Is there a way (in some report phase) to handle the last row of the column Perc to sum in it the difference between the effective column's sum (99.99) and 100 ?


Many thanks ,

Greetings

Alessio