jonathan.brooker Posted January 13, 2020 Share Posted January 13, 2020 Hi, I'm new to Jaspersoft and HTML / Java so everything I am doing is a bit of a shot in the dark, but I'm really stuck on something that feels like it should be simple.I have calculated some fields in the SQL to count the total cases within deadline and the total cases per team and put them in an ad hoc table. This looks to be working fine.I now want to add an extra column that calculates the percentage that are completed on time, i.e. $F{CompletedWithinDeadline}/$F{TotalCases}*100I have tried putting this formula in a text field and I have tried creating a variable, but both just show 0 when placed in the details part of the table.I'm stumped. This seems such a simple thing but much experimenting and searching for answers here has yielded nothing. Any help gratefully received! Link to comment Share on other sites More sharing options...
luked Posted January 13, 2020 Share Posted January 13, 2020 If you are using java.math.BigDecimal as your class you will need to use .divide and .multiply$F{CompletedWithinDeadline}.divide($F{TotalCases}).multiply(100) Link to comment Share on other sites More sharing options...
james.jordan Posted January 21, 2020 Share Posted January 21, 2020 I had the same problem getting percentages to work so I just calculated it in the query using this and made it a field. CAST(ROUND(100-(sum(OverdueCount) * 100.0 / sum(TotalCount)), 2) as decimal(10,2)) AS PercentCompliance 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