Getting Started
Introduction Data Input Designer Interface
Data Preparation
Selecting Data Data Type Conversion Cleaning Data Exercises
Filters & Joins
Documentation Filters Join Types Inner Join Outer Joins
Formulas & Aggregations
Formulas Aggregating Data
Sort & Output
Sorting Data Output Data
Other Tutorials & Content
Learn Python Python Data Science Reference Blog



Exercises

We’ve just gone through a few very useful tools and it’s likely you’ll use these over and again in your own Alteryx workflows so it’s time to get some additonal practice in using them.

Our workflow so far has only one (all be it now very clean) data source that contains data about what, when and who ordered from our ecommerce website but doesn’t tell us anything about the products that were actually ordered. Our task is to build a report to give insight into the sales performance of the fiction genre so we need to know which books were ordered from which genre. We can get this data from the products.csv file. In addition we will also need to know if any of the orders were subject to a promotional discount to enable us to calculate the value the customer acutally paid. We will need to import the promotions.csv file for this.

In the following exercises you will import and prepare the data as we have done for the orders data, before we move on to the next section where we will look at blending the data sources to create a new data set for processing.

Exercises Part 1

In the same workflow that we have been working on, perform the following tasks:

1. Import the "Products" csv file from the provided data.

2. Use auto-field to determine the optimum data type for each string field

3. There are three fields in the data set that will be imported as strings but are actually numeric. Determine which three and convert them to the most appropriate data type using the select tool. Also ProductID is an identifier as opposed to a value so let’s convert that to a string.

4. Make sure all string fields that contain Nulls are blank, all Nulls in numeric fields are converted to 0 and that there is no random leading and trailing whitespace in any of the fields. Now run the workflow to ensure there are no errors.

Exercises Part 2

1. Import the "Promotions" csv file from the provided data.

2. As before, use auto-field to determine the optimum data type for each string field

3. Again, make sure all string fields that contain Nulls are blank, all Nulls in numeric fields are converted to 0 and that there is no random leading and trailing whitespace in any of the fields.

Solutions Part 1

1. You should have an input tool dragged into the main workspace and have imported the Products.csv file from wherever you have saved the course data

Alteryx Import Data

2. Drag in an auto-field tool after the input tool and select all fields for processing

Alteryx Auto-field

3. Cost, Retail_Price and Shipping_Cost are all cash values and therefore require converting to FixedDecimal. Alteryx often sets FixedDecimal to size 19.6 where the 6 refers to the number of decimal places. As we know we are dealing with montery values let’s convert the 6 to a 2

Alteryx Select Tool

4. Add a Data Cleansing tool after the select tool and set the configuration as below

Alteryx Data Cleanse

5. If you run the workflow you should have an output like below

Alteryx Exercise Solution

Solutions Part 2

1. Drag in an Import tool and load Promotions file from wherever you have saved it

Alteryx Import Data

2. Drag in an auto-field tool after the input tool and select all fields for processing

Alteryx Auto-field

3. Add a Data Cleansing tool after the select tool and set the configuration as below

Alteryx Data Cleanse

Next