Aggregation of "percentages of total" and "percentages of sub-totals"
Is it possible to use the 'Percentage of Total' function but calculated for Sub-totals?
I have a report that calculates the % of the total number but I'd like it to do it for the Income and Expenditure respectively, I've included an additional column to show how I'd like the end result to look.
Since there have now been a couple of requests for this functionality, I have put together a custom advanced function to achieve this.
Upload the attached jar file through the plugin manager. The new function will be called "Sectioned Percentage of Total". Apply this to the column of choice, and select the column used for your sub-totals as the reference column. In the original example you would select MA2 as the reference column.
Let me know if you run into any problems with this.
Thanks for sending in the question. This might not be the cleanest way to express this (there might be other ways to accomplish this via Report from Report), but I think to accomplish what you are after you are going to need to consider using sub queries.
In your case, the master query would contain your MA2, MA4, BUD, and % of Total columns. Then you could create an individual sub query for income and expenditure each (filtering the sub query by either income or expenditure to limit the sub query results) to produce an individual % of Total.
Can you review this and let us know if this solution could work for you, or if you have any follow-up questions here? I look forward to hearing back!
Is this still the best way to calculate the % of subtotal?
Is this a bug or is there a setting needed to enable plugins? My user has the admin role.
Chances are, your user is lacking the appropriate role permission for this. It should be "Plugin Management" under the administration section.
Thanks Nathan. I finally found the Plugin Management setting under the Administration setting and enabled it for the admin role.
Could you attach the source code for the custom advanced function?. It woul be helpful to understand how to create one which receives the name of a column as a parameter (eg. the reference column in this case).
I have attached the source code for this.