I am supposed to create a report of a store where I need to calculate which items are sold more based on the total stock of items and total sold items and create a third column in report in percentage.
Is it possible to achieve this in Jasper report or I need to do something else ?
The report will look like as follow: I am able to fetch the item no, total in stock and total sold and I need to calculate the sold % based on total in stock and total sold.
For Jaspersoft Studio, I recommend looking at chapter 9, Variables, of the JSS User Guide.
You can create a variable and define an expression, which would be the calculation you want. Another possible calculation for the percent sold would be 100*total_sold/(total_in_stock + total_sold). There are problems with the calc suggested in previous answer, for example, if you sold everything, so total_in_stock = 0, you would get infinity for the percent sold, instead of 100%.