Reputation: 775
I'm building a report which should include a chart with the percentage of orders that contains a specific item per customer.
In plain report form I can easily accomplish this by grouping by customer and then using two running fields—one for distinct number of order IDs, and one for count of order IDs with condition that the item ID in the order-row-table matches the specific item sought after—and one formula field that divides the latter with the former and multiplies with 100.
Now, getting this data to a chart escapes me. Neither a chart nor the cross tab seems to allow me to use this formula.
Any ideas how to get around this?
——EDIT——
Example of data from database:
╔════════╗ ║ Orders ║ ╠════════╩═╤══════════╤═════════════════════╤═════╗ ║ Order ID │ Customer │ Order date │ ... ║ ╠══════════╪══════════╪═════════════════════╪═════╣ ║ 1 │ 0080 │ 2012-09-24 13:16:17 │ ... ║ ╟──────────┼──────────┼─────────────────────┼─────╢ ║ 2 │ GKEM │ 2012-09-22 19:31:54 │ ... ║ ╟──────────┼──────────┼─────────────────────┼─────╢ ║ ... │ ... │ ... │ ... ║ ╚══════════╧══════════╧═════════════════════╧═════╝ ╔════════════╗ ║ Orderitems ║ ╠════════════╩═╤══════════╤═════════╤═════╗ ║ OrderItem ID │ Order ID │ Item ID │ ... ║ ╠══════════════╪══════════╪═════════╪═════╣ ║ 1 │ 1 │ PNA │ ... ║ ╟──────────────┼──────────┼─────────┼─────╢ ║ 2 │ 1 │ PKA │ ... ║ ╟──────────────┼──────────┼─────────┼─────╢ ║ 3 │ 2 │ KARE01 │ ... ║ ╟──────────────┼──────────┼─────────┼─────╢ ║ 4 │ 2 │ PPKI │ ... ║ ╟──────────────┼──────────┼─────────┼─────╢ ║ 5 │ 2 │ PNA │ ... ║ ╟──────────────┼──────────┼─────────┼─────╢ ║ ... │ ... │ ... │ ... ║ ╚══════════════╧══════════╧═════════╧═════╝
Getting the number of orders from a given customer in a given period of time in a cross tab (or chart) I can do.
Getting the number of orders that contains a specific item ordered from a given customer in a given period of time in a cross tab (or chart) I can do too.
Getting the percentage of orders that contains a specific item ordered from a given customer in a given period of time in a cross tab (or chart) is the problem.
The report has to be in Crystal Reports XI, since the automatic report generation software that the report is to be run on can't handle newer Crystal Reports-files.
Upvotes: 0
Views: 2209
Reputation: 112
I suspect you're running afoul of the inability of Crystal reports to put print-time variables into charts. If your formula makes any use of running totals for instance then it just won't work. That said, you can pass these values to a sub-report which will allow you to then use that data in a chart, so that might be your best bet.
Upvotes: 0