153|ALTERYX – COVID-19 Find and Replace

BYU Student Author: @Andrew_Wilson
Reviewers: @Sterling_Lane, @Marta_Ellsworth
Estimated Time to Solve: 30 Minutes

This is an intro challenge that is part of the Alteryx Learning Path.

We provide the solution to this challenge using:

  • Alteryx

Need a program? Click here.

Overview
At Simple Screenprinting we believe in quality work and accurate information. Your manager is preparing for a meeting to discuss the effects of COVID-19 on sales here at Simple Screenprinting; however, because the Orders table is part of a normalized database, it is hard to read without always referencing other tables. As you know, several of the columns (i.e. FreightID, SalesRepID, and JobTypeID) are presented foreign keys in other tables. Because of the upcoming meeting, your manager needs the information to be summarized and readable to other managers. It is extremely important that the data be stored in an Excel spreadsheet because your manager has never used Alteryx and thus cannot access an Alteryx file.

You will produce two separate reports, one for 2019 and one for 2020 outlining the number of each JobTypeID per Sales rep based upon how it was shipped out. You will use the Find and Replace, Transpose, Cross Tab and Output Data Tools to create readable reports for your manager’s upcoming meeting.

Your report should include the following information:

  1. Orders that were placed in 2020 based OrderDate
  2. Sales Rep Name
  3. Job Type name
  4. Count of each relevant shipping type, excluding delivery by Sales Reps (i.e. SHC – Deliver), in separate columns
  5. The Year (2020) in a separate column

Additionally, you should ensure your report is formatted using the following guidelines:

  • Orders should appear based on 1.) the Sales Rep from A-Z, 2.) Job Type from A-Z
  • Headers should appear as below

Instructions

  1. Download the challenge data and data dictionary below
  2. Familiarize yourself with the data and import the data into Alteryx using an Input tool (Orders table, Job Types Table, Employees Table, and Freight Table)
  3. Change relevant data types (JobTypeID, SalesRepID, FreightID) to allow use of the Find and Replace tool (See hint 1)
  4. Filter out any orders whose OrderDate is not in 2020
  5. Use the Find and Replace tool to change data in the orders table (See hint 2)
    • SalesRepID to Sales Rep Name
    • Job Type ID to Job Type Name
    • FreightID to Freight Name
  6. Use a Cross Tab tool to rearrange the data and count the quantity of orders based on Freight type. Make sure the JobTypeID and SalesRepID are selected in the Group By wizard. The column headers should be FreightID and the Value should be a count of the JT_Num (See Hint 3)
  7. Use the Append Tool to add the year (2020) to each line of data (See Hint 3)
  8. Select only the necessary rows
  9. Order by SalesRep and JobType
  10. Output the information to an Excel document using the Output tool. The sheet name should be the year (2020) you are analyzing
  11. Repeat the whole process for 2019 and compare the outputs. See if you can see any significant difference between the two years. You can compare more frequent shipping methods (i.e. Will_Call) to see if there is a significant difference in number of orders placed

Data Files

Suggestions and Hints
  1. The Find and Replace tool can only work with string data fields. You need to use a Select tool to change the data type before using a Find and Replace tool.
  2. Be careful that you connect smaller tables (JobTypes, Employees, Freight) to the Replace “R” side of the tool and the main table (Orders) to the Find “F” side of the tool. For more information, please refer back to the Alteryx Getting Started Module
  3. The Cross Tab tool is designed to use numeric data. Use a select tool to change the JT_Num to a Double.
  4. Use a Text Input tool to manually create the desired text input (2020)
  5. In the Output tool, under Output options select “Overwrite Sheet or Range” to prevent Alteryx from creating multiple files or sheets
  6. To repeat work you have already done, try copying and pasting

Solution

The Find and Replace tool is really powerful for extracting the right information from the tables, and I found that Alteryx ran a lot faster when I did those Find and Replaces instead of Joins like I initially wanted to. Also, thanks for the tip on the Copy and Paste! That saved me a lot of time doing the 2019 results.

This challege helped me realize that I am not using the Fine and Replace too nearly enough in Alteryx. Here is my 2020 querey, because my 2019 one is just a copy of this one.