Cr10, sql data base, two tables lgh and ord linked by ord_hdrnum.
I need to take the following data and calculate
Total revenue per unit (lgh_tra)
I know somewhat how I need to do it, but translating into crystal has proven difficult.
First I need to come up with the total miles for each order <ord_hdrnum>
I get that by adding up each leg <lgh_num,lgh_mil> for each order.
Then I need to add up the lgh_mil per truck per order, and divide that by the total miles per order to find out the percentage of miles per order the unit ran. Then I multiply that percentage by the order charge to find out the revenue for that unit for that order. And finally sum all the revenue and miles per unit.
Looks easy on paper, but I just cant get a handle on this in Crystal.
Sample data
Final Output:
Any assistance appreciated.
Julie
CR 9,10 CE10 Sql DB
I need to take the following data and calculate
Total revenue per unit (lgh_tra)
I know somewhat how I need to do it, but translating into crystal has proven difficult.
First I need to come up with the total miles for each order <ord_hdrnum>
I get that by adding up each leg <lgh_num,lgh_mil> for each order.
Then I need to add up the lgh_mil per truck per order, and divide that by the total miles per order to find out the percentage of miles per order the unit ran. Then I multiply that percentage by the order charge to find out the revenue for that unit for that order. And finally sum all the revenue and miles per unit.
Looks easy on paper, but I just cant get a handle on this in Crystal.
Sample data
Code:
lgh_tra ord_hdrnum lgh_numb lgh_mil ord_cha
226 721508 181427 108 $389.00
250 721508 182880 378 $389.00
185 721533 181478 448 $1,490.
200 721533 181466 159 $1,490.
200 721534 181467 159 $1,490.
200 721534 182183 34 $1,490.
223 721534 181484 414 $1,490.
185 721535 181485 448 $1,490.
200 721535 181468 159 $1,490.
200 721535 182348 34 $1,490.
185 721536 181488 414 $1,490.
200 721536 181469 125 $1,490.
200 721536 182892 34 $1,490.
Final Output:
Code:
lgh_tra Total Rev Tot Miles
200 $1,726.14 704
226 $86.44 108
250 $302.56 378
223 $1,016.24 414
185 $3,217.62 1310
Any assistance appreciated.
Julie
CR 9,10 CE10 Sql DB