Mike Lewis
Programmer
I am working with CR 8.5 against an Oracle database.
I have produced a report showing sales per product. The input table is a list of transactions. The details section shows the value of each sale. I am grouping this on product, with total value per product in the group footer, plus grand totals in the report footer. I have suppresed the details section.
This gives me exactly what I need.
I now want to limit the report to show the top 20 products by sales value. I have added Top N sorting to the report, and this also works fine.
However, I need to show the total sales value, not for the entire product range, but only for the top 20. As things stand, the grand totals reflect the sales of all products, not just the top 20.
I couldn't see any way of summarising just the top 20, so I wrote a formula (called Update) which maintains a running counter for the sales value. The formula simply adds the individual amounts into a variable. I placed this in the details section, and added another formula (called Display) to display the final value of the variable in the report summary.
This also works fine.
My first question is: Is this the best way to handle this situation? Or is there a simpler way of showing the grand totals to the top N groups?
My other question is: Assuming I go with the above solution, how can I display, for each product, the sales of that product as a percentage of the total sales for the top 20?
I thought I could add a formula (call it Percent) to the group footer, showing the current product's sales as a percentage of my Display formula. The problem is that, when that new formula is evaluated, the final Display figure has not yet been determined. We don't get that until we reach the report footer.
I tried telling Percent to evaluate after Display, but that made no difference.
Am I going about this problem in the right way, or is there something I am missing?
Thanks in advance.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
I have produced a report showing sales per product. The input table is a list of transactions. The details section shows the value of each sale. I am grouping this on product, with total value per product in the group footer, plus grand totals in the report footer. I have suppresed the details section.
This gives me exactly what I need.
I now want to limit the report to show the top 20 products by sales value. I have added Top N sorting to the report, and this also works fine.
However, I need to show the total sales value, not for the entire product range, but only for the top 20. As things stand, the grand totals reflect the sales of all products, not just the top 20.
I couldn't see any way of summarising just the top 20, so I wrote a formula (called Update) which maintains a running counter for the sales value. The formula simply adds the individual amounts into a variable. I placed this in the details section, and added another formula (called Display) to display the final value of the variable in the report summary.
This also works fine.
My first question is: Is this the best way to handle this situation? Or is there a simpler way of showing the grand totals to the top N groups?
My other question is: Assuming I go with the above solution, how can I display, for each product, the sales of that product as a percentage of the total sales for the top 20?
I thought I could add a formula (call it Percent) to the group footer, showing the current product's sales as a percentage of my Display formula. The problem is that, when that new formula is evaluated, the final Display figure has not yet been determined. We don't get that until we reach the report footer.
I tried telling Percent to evaluate after Display, but that made no difference.
Am I going about this problem in the right way, or is there something I am missing?
Thanks in advance.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)