Brilton Madley, a board game manufacturer, hired a new CEO. She asked for your assistance in providing summaries of data that took place before she started with the company. To help her with her strategic planning, you will create queries to perform data analysis. Based on your meeting, you plan on creating four queries. One query will find orders with minor delays. Another query will summarize company revenue and cost by country. A third query will be used to help evaluate payments made by customers on their orders. The final query will calculate the total sales by sales representative title.
Step 1
Start Access. Open the downloaded Access file named Exp19_Access_Ch03_Cap_Brilton_Madley_Games.accdb.
Step 2
Create a query using Query Design. From the Customers table, include the fields FirstName, LastName, and Phone (in that order). From the Orders table, include the fields OrderID, OrderDate, and ShippedDate (in that order). Run the query and then examine the records. Save the query as Shipping Efficiency.
Step 3
Add a calculated field named DaysToShip to calculate the number of days taken to fill each order. (Hint: the expression will include the OrderDate and ShippedDate fields; the results will not contain negative numbers.) Run the query and then examine the results. Save the query.
Step 4
Add criteria to limit the query results to include any order that took more than 30 days to ship.
Step 5
Add the Quantity field from the Orders table and the ProductName field from the Products table to the query (in that order). Sort the query by ascending LastName.
Step 6
Add the caption Days to Ship to the DaysToShip field. Switch to Datasheet view to view the final results. Save and close the query.
Step 7
Create a query using Query Design and add the Customers, Orders, and Products tables. Add the Country field from the Customers table. Set the field's Total row to Group By. Save the query as Revenue and Cost by Country.
Step 8
Add a calculated field in the second column. Name the field TotalRevenue. This field should multiply the quantity ordered (from the Orders table) by the unit price for that item (from the Products table). Format the calculated field as Currency and change the caption to Total Revenue. Change the Total row for the TotalRevenue field to Sum.
Step 9
Add a calculated field in the third column. Name the field TotalCost. The field should multiple the quantity ordered (from the Orders table) by the unit cost for that item (from the Products table). Format the calculated field as Currency and add a caption of Total Cost. Change the Total row to Sum. Run the query. Save the query. Return to Design view.
Step 10
Add the OrderDate field and criteria to that field so that only orders made between 7/1/2018 and 12/31/2018 are displayed. Change the Total row to Where. This expression will display only orders that were completed during the second half of 2018. Run the query and view the results. Save and close the query.
Step 11
Create a copy of the Revenue and Cost by Country query named Customer Payments. Switch to Design view of the new query and remove the Country, TotalCost, and OrderDate fields. Add the FirstName and LastName fields. Move the TotalRevenue field to the end. Rename the TotalRevenue field to OrderTotal. Change the caption to Order Total.
Step 12
Add a new field using the Expression Builder named SamplePayment. Insert the Pmt function with the following parameters:
Step 13
Change the Total row to Expression for the SamplePayment field. Change the Format for the SamplePayment field to Currency. Run the query and verify the second order(with LastName Sparks) has a sample payment of $26.80. Note: it will display as a negative number. Save and close the query.
Step 14
Create a copy of the Revenue and Cost by Country query named Revenue by Sales Rep. Switch to Design view of the new query and remove the entire Customers table, the TotalCost, and OrderDate fields. Add the Sales Reps table. Add the Title field from the Sales Reps table and move it to the front of the TotalRevenue field.
Step 15
Run the query and then examine the summary records; there should be 4 Titles listed. Switch to Design view and change the sort order so that the title with the highest TotalRevenue is first and the title with the lowest TotalRevenue is last. Run the query and verify the results. Save and close the query.
Step 16
Close all database objects. Close the database and then exit Access.