Jump to content
We've recently updated our Privacy Statement, available here ×

Calculate percent in table subtotal


drummer54

Recommended Posts

I'm at my wits' end over this.  I've created a table in JasperSoft Studio with subtotals on region and company.  The detail data from the database contains, by location (the hierarchy is company / region / location), values for number of employees, total number of compliance events for all employees for that location, number of events that are in compliance, number of events not in compliance, and percent in compliance.  For example, the first location has 40 employees, 1793 total events, 1760 events in compliance and 33 events not in compliance.  That results in a compliance percent of 98% after rounding, 1760 / 1793.  All of this data is returned by the database query.  The problem I'm having is in computing region and company percents.  I have to sum the events in compliance and the events not in compliance across region and company levels and then perform the calculation to get the percent in compliance for each region and the company as a whole.  How is this done?  Everything I've tried either results in 0 for the percent or an "Error evaluating expression".

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

I've uploaded the latest JRXML file, the latest of several attempts. This one doesn't produce an error but it returns 0 for the calculated percent. The variable mth1_individual is where the percent is being calculated as the result of (mth1_compliant / (mth1_compliant + mth1_noncompliant)) * 100
Link to comment
Share on other sites

I discovered this morning that none of my subtotals is working properly. If I run the report for a single region within a company the totals are correct, but if I run it for multiple regions in a company the simplest grouping becomes accumulative. In other words, for example, the employee head count for region 1 is correct but for region 2 is the accumulation of regions 1 and 2, region 3 is the accumulation of regions 1, 2 and 3 and so on. And the percent column is simply the first region percent and never gets updated. I can't believe how unintuitive and poorly documented this application is.
Link to comment
Share on other sites

  • 2 weeks later...
No one knows how to get this to work? I'm still having this problem and see no way around it. I might have to report it as a bug, because I've created groups and shouldn't those group footers provide subtotals for that group rather than a running total? It's not the kind of thing I should have to jump through hoops to get to work.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...