Jump to content
Changes to the Jaspersoft community edition download ×

Counting occurrences of values in groups.


hesher

Recommended Posts

Hi,

I've been trying to display a table with grouping and to sum up a few statistics for every group.

Somethiing a bit like this:

 

--------------------

Name         Age           Heigh

(Group Header) First Grade

John          6                 101      Boy
Lisa           6.2               78       Girl

(Group Footer) Number of Kids over 80 Cm Tall: 1
(Group Footer) Pie Chart with division to Boys/Girls

----------------

(Group Header) Second Grade

Jay              7.1               108    Boy
Mona          7.2               110    Girl

(Group Footer) Number of Kids over 80 Cm Tall: 2
(Group Footer) Pie Chart with division to Boys/Girls
 

---------------------------------

So what I don't know how to do is the summary for each group.
Is there some way to aggregate data for groups?

Thanks again!

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Good example ;-) Students/classes is my favorite one too...

So, for the statistics, create a variable for each statistic, in example for Tall over 80cm:

Var name: TALL_OVER_80
Calc: Sum
Expression:  $F{Height} > 80 ? 1 : 0
Type: Integer
Reset type: Group
Group name: Grades

(I'm using groovy to make the expression simpler).

Now, suppose you are able to put in two variables using the same idea BOYS and GIRLS
Create a pie chart (you need 2 series, so iReport 3.5.2 is required)

Series 1:
Key: "BOYS"
Value:  $V{BOYS}
Label: "Boys"

Series 2:
Key: "GIRLS"
Value:  $V{GIRLS}
Label: "Girls"

Chart evaluation time: now

Giulio

 

 

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...