justin.watts Posted January 26, 2018 Share Posted January 26, 2018 I am trying to do division between a group count and a report count, but the calculations are not coming out correct. Here are my variable: DiscIncCount - doing a simple count calculation and resetting by groupTotalDiscIncCount - doing a simple count calculation and resetting by reportDiscIncPercent - $V{DiscIncCount}.divide($V{TotalDiscIncCount},2,RoundingMode.HALF_UP) - the calculations for this variable is not coming out correctly. For example, if I have 4 for one of the group totals and 640 for the report total (4/640), it should come out to .63, but it is coming out to .01.All of these variable are set to BigDecimal class. Link to comment Share on other sites More sharing options...
elizam Posted January 26, 2018 Share Posted January 26, 2018 4/640 is 0.00625, which rounds up to 0.01 Link to comment Share on other sites More sharing options...
justin.watts Posted January 29, 2018 Author Share Posted January 29, 2018 Thans Elizam! Totally forgot about the rounding part. I appreciate the help. Link to comment Share on other sites More sharing options...
justin.watts Posted January 30, 2018 Author Share Posted January 30, 2018 Still having an issue with this. If I have a group total of 2 (which would be 2/662), I get 0.01 for one group. However, in another group I have total of 2 and it come out to 0.14. I have the calculating variable set the evaluation time of the group. Is there something I should be using besides Rounding.Mode.HALF_UP? The calculations vary from group to group. 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