Report Designed: Calculating sum of percentages
Hello, I've created a simple report that lists some parcel attributes: Total Acres, Vacant Acres, and % Vacant Acres (vacant acres is some percentage of total acres). Using the following sample:
Total Vacant %
5 2 40%
10 8 80%
I have them set up in a group, and I use the SUM (Grand Total) function for Total Acres (15) and Vacant Acres (10), but how do I calculate the overall percentage (67%)? It's obviously not just a matter of summing on the percentage column, which would yield 120%.
Thanks!
Chris
-
Hi Chris,
There is no way to calculate the overall percentage only using the individual percentages, since you need them weighted by their Total size. Rather than basing the overall percentage off the individual percentage values, can you calculate it with the summed values? Something like:
=SUM(Vacant) / SUM(Total)
0 -
Hi Paul. I ended up adding a GroupFooter BeforePrint function. In there, I grabbed the values from the Total Acres textbox sum and the Vacant Acres textbox sum (in the group footer), and did the calculation. I then assigned the results to a textbox.
The only thing I'm not sure about is that by grabbing the textbox values from the Total Acres and Vacant Acres summaries, I then needed to convert them to doubles for the calculation. Seems to me I should be using the raw sum values, not the formatted string values. I wasn't sure exactly how to access the raw sum values though.
Thanks,
Chris
0 -
Hi Chris,
I was unable to find a better solution than what you suggested. Summary fields in Active Reports don't seem to have a built-in way to handle weighted averages.
0 -
Thanks for looking into it Paul.
I ended up setting up a series of invisible "dummy" text boxes in the group footer that stored the full double value of the sum of each column. I used these to calculate the percentages.
I'm surprised there's not a straight forward way of calculating overall percentages in ActiveReports...
Chris
0 -
Can someone provide a sample report? I have the same problem and I can't figure out how to get the summarized values to calculate the percentages.
Robert0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
5 kommentarer