Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Aggregating over percentage values... Totals do not add up
newbie321
<div>How do you aggregate over the percentage values that are themselves result of a group aggregation? </div>
<div> </div>
<div>As an example, I prepared an .rptdesign file that relies on the Classic Cars datasource. I am also including a screenshot of the output. </div>
<div>As you can see, the aggregation over the actual dollar amounts (col #2) is good and correct. But when I use the similar aggregation to add my percentages in col #3, then I get 345% as a result. Clearly, it should add up to 100%. </div>
<div> </div>
<div>Any ideas how to to SUM over the aggregated percent values? </div>
<div> </div>
<div>Thanks,</div>
Find more posts tagged with
Comments
micajblock
<p>Why do you need this? Just put a label with 100%. mathematically it will always add up</p>
<p> </p>
<p>the reason you are getting wrong numbers is that you are using the group binding which will repeat for every row. </p>
newbie321
<p>Thanks!! </p>
<p> </p>
<p>Yes, I understand I can hard code that sell to 1 as you suggested. But I would rather have be calcuated based on the aggregated percentage values. </p>
<p> </p>
<p>Regarding the group binding, I also operated on the entire table. Value of '100%' was not produced. </p>
micajblock
<blockquote class="ipsBlockquote" data-author="newbie321" data-cid="139903" data-time="1445983478">
<div>
<p><span style="font-size:12px;">But I would rather have be calcuated based on the aggregated percentage values. </span></p>
</div>
</blockquote>
<p>Why? In the end no matter how you calculate it you will always be 100%. In any case it might be the way PERCENTSUM works. I never use that to create a PCT.See attached example for the correct way to create percentages.</p>
newbie321
<p>I do not have a sophisticated answer on the 'why' question... For starters, it is yet another 'sanity' check showing that the sum of aggregated percentages actually adds up to 100%.</p>
<p> </p>
<p>Speaking of 'why'... The 'why' that is very intriguing (at least to me) is: </p>
<p>--Why does the SUM aggregate correctly over the non-percentage aggregations (col #2 in the example) and fails to do the same for percentile values. Fundamentally, percentages are also numbers (in decimal form) that the SUM should process without any problems. Yet, it does not... Why? </p>
<p> </p>
<p>Thanks,</p>
micajblock
<blockquote class="ipsBlockquote" data-author="newbie321" data-cid="139906" data-time="1446042296">
<div>
<p><span style="font-size:12px;">--Why does the SUM aggregate correctly over the non-percentage aggregations (col #2 in the example) and fails to do the same for percentile values. Fundamentally, percentages are also numbers (in decimal form) that the SUM should process without any problems. Yet, it does not... Why? </span></p>
</div>
</blockquote>
<p>I do not know (might be something internal to PercentSum). I any case I provided an example that works.</p>
<p> </p>
<p>P.S. I can see instances where summing the percentages might not return 100% due to rounding of numbers.</p>
newbie321
<p>Thanks, Mica!! </p>
<p> </p>
<p>I looked at your example. I see what you did there is essentially what I would think PercentSum does. That leads me to only one conclusion, which you very well also stated: might be something internal to PercentSum. </p>
<p> </p>
<p>Now, a related but slightly different question:</p>
<p>-- How does one know if this should be viewed as a bug or it is a part of a design spec for the PercentSum function? Do you know by chance who maintains BIRT - is it Actuate or the community? </p>
micajblock
<p>It is Actuate that is now OpenText. I think you can file a bug on bugzilla via eclipse.org.</p>
newbie321
<p>Thanks, I will look into that - my hunch tells me there was a reason why the percentile aggregation works it the way it works. I will try to submit a bug and will see what happens.
</p>
<p> </p>
<p>Thanks again!! </p>