macaxrc Posted March 28, 2015 Share Posted March 28, 2015 Hi every body, I'm use JasperStudio 5.5 and need calculate subgrups in a table.I know that this is possible using field and detail band.But I dont' know that this is possible in table component.I have the follow query and resultSelect a,b,mesurefrom tablegroup by a,b the result is this A----B----mesureA--- C--- mesureB--A------mesureB----C----mesure I'm need to calculate the subtotatals of A like thisA----B----mesureA--- C--- mesureTOTAL---""--total mesure AB--A------mesureB----C----mesureTOTAL---""--total mesure BCan you help me? Thanks Link to comment Share on other sites More sharing options...
Tom C Posted March 28, 2015 Share Posted March 28, 2015 First of all, your SQL query will not work because "measure" column is not part of the GROUP BY clause or used in an aggregate function.The simplest way to resolve this issue is to use the following querySelect a, b, measure from table order by a, bthen create report group "group_a" using $F{a} (column a) in the group expression. Create a variable "sum_measure" to summarize $F{measure} with reset type set to group "group_a". Now you can place this variable $V{sum_measure} in the group footer section to display total measure for column a. Link to comment Share on other sites More sharing options...
macaxrc Posted March 29, 2015 Author Share Posted March 29, 2015 Thanks tchen I find the solution. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now