matthew.friendars.usda.go Posted July 30, 2020 Share Posted July 30, 2020 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.... Thanks,Matthew Link to comment Share on other sites More sharing options...
matthew.friendars.usda.go Posted July 30, 2020 Author Share Posted July 30, 2020 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 :) Link to comment Share on other sites More sharing options...
darth_fader Posted July 30, 2020 Share Posted July 30, 2020 You have at least two options: 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 neededif 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 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