pathfinder2104.work Posted March 12, 2014 Share Posted March 12, 2014 Hello all,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. Link to comment Share on other sites More sharing options...
pathfinder2104.work Posted March 12, 2014 Author Share Posted March 12, 2014 I am using List element to display this data. Link to comment Share on other sites More sharing options...
hozawa Posted March 12, 2014 Share Posted March 12, 2014 Yes, you can do it with JasperReports and with JasperReports Server in AdHoc reports.JJust create a text field. Link to comment Share on other sites More sharing options...
pathfinder2104.work Posted March 12, 2014 Author Share Posted March 12, 2014 Hi, I am a novice in Jasper report can you please explain in brief how can I achieve it ? Link to comment Share on other sites More sharing options...
pathfinder2104.work Posted March 12, 2014 Author Share Posted March 12, 2014 Need to carry out the calculation using the two fields of total in stock and total sold. (total in stock means when the shop opens at that time what ever was the stock) and this report is to be generated at the end of the day.) calculation would be 100*total_sold/total_in_stock using this calculation I want to display the precentage. Link to comment Share on other sites More sharing options...
Solution elizam Posted March 12, 2014 Solution Share Posted March 12, 2014 For Jaspersoft Studio, I recommend looking at chapter 9, Variables, of the JSS User Guide.http://community-static.jaspersoft.com/sites/default/files/docs/jaspersoft-studio-user-guide.pdfYou 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%. Link to comment Share on other sites More sharing options...
pathfinder2104.work Posted March 13, 2014 Author Share Posted March 13, 2014 Thank you elizam for this answer ..... :) :) :) :) :) Link to comment Share on other sites More sharing options...
pathfinder2104.work Posted March 14, 2014 Author Share Posted March 14, 2014 Hey there, thank you for answering the question, Now I have another requirement of calculating the average of the fourth column that I have created by finding the percentage. Can I do it? How ? Any pointers would help thank you. 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