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)
Aggregation AVE and BirtMath.roundUp issue
kylebober
I have a table that I want to take the Average of one of the columns. I am trying to round the decimal precision to 2 decimal points. I.E. 11.1666666667 to 11.17
Through the Aggregation builder I am using the AVE function. I select the expression button and choose the available data set and the column (the column is a float value) I want the average of. Now I want to round the value to two decimal points. I tried using the following expression 'BirtMath.roundUp(dataSetRow["Title"], 2)' but every time I preview the data I am getting the value 11.166666666 instead of 11.17 like I would expect. This seems like something very simple to do but I can't seem to get it right. Any help would be much appreciated here!
Thanks,
Kyle
Find more posts tagged with
Comments
mwilliams
Hi Kyle,
Have you tried using the format Number section of the property editor to limit it to 2 decimal places?
kylebober
I have not. How would I do that exactly? By the way I am using BIRT 2.3.2
mwilliams
Kyle,
You would select the aggregation element in your report, go down to the "Format Number" section of the property editor, choose "fixed" from the drop down and select 2 decimal places.
kylebober
Excellent! Thanks for your help Michael.
mwilliams
No problem. Let us know whenever you have questions!
vshah
Hi Michael,
I have a doubt. I have used "Format Number" property up to 1 decimal place. And for the aggregate function to calculate the total of the above rows, I am using the raw database without any rounding.
However after the "Format Number", the data visually adds up to 100.1. This is being displayed by BIRT. So does BIRT round up to the property defined and then aggregate or the formatting does not interfere with aggregation?
I want to show the total as 100 (which is the case w/o rounding up and the sum of raw data)
A sample of the data that BIRT currently shows is
0.1
23.8
20.7
22.1
20.6
5.4
7.4
Total 100.1
Thank you very much for all you help so far
mwilliams
So, your raw data adds up to 100.1 and you want it to show 100? Or BIRT is showing 100.1 and it's supposed to be 100 even? I'm pretty certain BIRT keeps track of the actual value, but displays the number as you format it. In this case, if you set the value to show 0 decimal places, your total would be 100 like you want. Not sure if I answered your question or not. Let me know.
vshah
NO, the raw data adds up to 100. But currently I am getting the value as 100.1 by using the aggregate function.
vshah
Thank you for replying so quickly,
I deleted the agggregrate function and replaced it with a new one and it works fine now.
It think the reason was:
I have had previous experiences where if i remove a data item/aggregrate function from the layout, it many a times still remains in the XML. YOu have manually remove it from the XML even if you deleted from the layout.
Earlier I had used round upto 1 decimal place which was still residing in the XML, even though i had removed from the layout because of which it was giving me 100.1. I manually removed from the XML and it works fine now.
Thank you for your help
mwilliams
Not a problem. Let us know whenever you have questions!
vishal44
<p>i want, how to use aggregate function in rptdesign file.</p>
<p>Please reply.</p>
pricher
<p>Hi,</p>
<p> </p>
<p>This is a good <a data-ipb='nomediaparse' href='
http://help.eclipse.org/juno/index.jsp?topic=/org.eclipse.birt.doc/birt/ag-HowToDisplayAggregateData.html'>start</a>. </p>
;
<p> </p>
<p>And if you have more questions after reviewing the documentation, please start a new thread in this forum.</p>
<p> </p>
<p>Regards,</p>
<p> </p>
<p>P.</p>