How to get an average instead of a total for a pivot table in a report


Hi Folks:

I have a pivot table that by default it seems is giving a total value for each animal grouping (The darker blue).   What I want though is an average of those three years for each animail.

Here is an example of how it looks:

Code view:

Expression Editor:

I figured would be able to find an "avg" function or something but didn't.  This is probably simple to change but I can't figure it out...

Thanks for any help....



Matthew's picture
Joined: Jul 16 2017 - 1:57pm
Last seen: 1 month 4 weeks ago

Hi Folks:

I guess if I can figure out how to divide the variable by 3 I could get the result I want.

So I've tried stuff like:  $V{CORN1_MEASURE}.divide( java.math.BigDecimal ,3 )     which gives an error because I'm dong something wrong.   What do I need to put after   $V{CORN1_MEASURE}   to divide by 3? 

Thanks :) - 9 months 2 weeks ago

1 Answer:


You have at least two options: 

  1. create a new measure, based on the same field that corn1_measure uses, but set the measure calc to AVG rather than SUM, and drop that into your row totals as needed
  2. if you want to do the divide method, you'll need to do someting like $V{CORN1_MEASURE}.divide(new BigDecimal(3))

Check google / stack overflow on how to divide BigDecimal if what I provided throws an error


darth_fader's picture
Joined: Mar 7 2010 - 9:45pm
Last seen: 1 week 4 days ago