Home » Archived » BIRT » how to make sum of percentile = 100 
| how to make sum of percentile = 100 [message #365648] | 
Tue, 21 October 2008 04:56   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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
 |  
 |  
  |  
| Re: how to make sum of percentile = 100 [message #365660 is a reply to message #365648] | 
Tue, 21 October 2008 12:43    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: jasonweathersby.alltel.net 
 
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 
>
 |  
 |  
  |  
| Re: how to make sum of percentile = 100 [message #365812 is a reply to message #365660] | 
Tue, 04 November 2008 11:12    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
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
 |  
 |  
  |  
| Re: how to make sum of percentile = 100 [message #365813 is a reply to message #365812] | 
Tue, 04 November 2008 11:32    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: jasonweathersby.alltel.net 
 
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 
>  
>  
>  
>
 |  
 |  
  |  
| Re: how to make sum of percentile = 100 [message #365841 is a reply to message #365813] | 
Thu, 06 November 2008 10:44    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi , jason , 
the total value should be 100. 
But this isn't a problem , since I set it to 100 simply by doing 
via java a  
   'compColumn.setExpression("100");' 
 
where compColumn is a ComputedColumn object. 
 
Now I found an (ugly) solution , making a javascript global var , i.e.  
'realSum = 0'  
sum in it the real partial percentiles during the report factory phase . 
At the end , the variable realSum will be 99.99. 
Then I only have to add to the last perc column row , 100-99.99 , to make  
the column sum = 100. 
 
Now the question is : is there a way to handle via javascript the last cell 
of the column Perc to add in it the value 0.01 ? 
 
Thanks , 
 
Greetings 
 
Alessio 
 
 
where compColumn is a  
Jason Weathersby wrote: 
 
> 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 
>>  
>>  
>>  
>>
 |  
 |  
  |  
| Re: how to make sum of percentile = 100 [message #365887 is a reply to message #365841] | 
Mon, 10 November 2008 11:33    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: jasonweathersby.alltel.net 
 
Alessio, 
 
I apologize for the late reply.  I did not see your post.  Did you get  
an answer to this question?  If you use a global JS var, you should be  
able to access it in the expression builder for any data item. 
 
ie (example expression) 
 
row["mydatavalue"]+ myglobablvar; 
 
Jason 
 
 
Alessio Lai wrote: 
> Hi , jason , 
> the total value should be 100. 
> But this isn't a problem , since I set it to 100 simply by doing 
> via java a   'compColumn.setExpression("100");' 
>  
> where compColumn is a ComputedColumn object. 
>  
> Now I found an (ugly) solution , making a javascript global var , i.e.  
> 'realSum = 0' sum in it the real partial percentiles during the report  
> factory phase . 
> At the end , the variable realSum will be 99.99. 
> Then I only have to add to the last perc column row , 100-99.99 , to  
> make the column sum = 100. 
>  
> Now the question is : is there a way to handle via javascript the last cell 
> of the column Perc to add in it the value 0.01 ? 
>  
> Thanks , 
>  
> Greetings 
>  
> Alessio 
>  
>  
> where compColumn is a Jason Weathersby wrote: 
>  
>> 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 
>>> 
>>> 
>>> 
>>> 
>  
>
 |  
 |  
  |  
| Re: how to make sum of percentile = 100 [message #365899 is a reply to message #365887] | 
Tue, 11 November 2008 02:44   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Thank you , Jason ,for the suggest. I'll try that. 
 
Best regards , 
 
Alessio 
 
 
Jason Weathersby wrote: 
 
> Alessio, 
 
> I apologize for the late reply.  I did not see your post.  Did you get  
> an answer to this question?  If you use a global JS var, you should be  
> able to access it in the expression builder for any data item. 
 
> ie (example expression) 
 
> row["mydatavalue"]+ myglobablvar; 
 
> Jason 
 
 
> Alessio Lai wrote: 
>> Hi , jason , 
>> the total value should be 100. 
>> But this isn't a problem , since I set it to 100 simply by doing 
>> via java a   'compColumn.setExpression("100");' 
>>  
>> where compColumn is a ComputedColumn object. 
>>  
>> Now I found an (ugly) solution , making a javascript global var , i.e.  
>> 'realSum = 0' sum in it the real partial percentiles during the report  
>> factory phase . 
>> At the end , the variable realSum will be 99.99. 
>> Then I only have to add to the last perc column row , 100-99.99 , to  
>> make the column sum = 100. 
>>  
>> Now the question is : is there a way to handle via javascript the last cell 
>> of the column Perc to add in it the value 0.01 ? 
>>  
>> Thanks , 
>>  
>> Greetings 
>>  
>> Alessio 
>>  
>>  
>> where compColumn is a Jason Weathersby wrote: 
>>  
>>> 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 
>>>> 
>>>> 
>>>> 
>>>> 
>>  
>>
 |  
 |  
  |   
Goto Forum:
 
 Current Time: Tue Nov 04 01:03:17 EST 2025 
 Powered by  FUDForum. Page generated in 0.05111 seconds  
 |