2022: Week 16 - Solution
Solution by Tom Prowse and you can download the workflow here.
We're looking at restaurant orders this week and how we can change the structure of the input so that it's easier to understand for when the chefs come to cook up the food.Step 1 - Input Data
4 input steps:
Example of the fields retained from Jenny's input:
Once we have input the 4 separate inputs, we can combine these using a union step and then merge the fields so that all of the names are in a single field and the selections are in another field. You can merge these fields by highlighting the chosen fields, then right-click and choose 'Merge Fields':
After the fields are merged we can then rename the fields to Guest, Dish, and Selections. For the Guest field, we want to rename each of the 4 Table Names values to be the corresponding name from the input. This is a manual step, so double click on a value in the profile pane and update.
Our table should now look like this:
Step 2 - Extract Course Name
We're now ready to combine the recipe lookup table with our orders. We can do this by using an outer join where Dish = Dish and we want to return all of the order fields.
Then we can extract the course from the Dish list by using the following calculation:
Course
Then we can use Tableau Prep's grouping functionality to group together the similar fields (eg, Starter & Starters), and as a result our table now looks like this:
Step 3 - Fill Down Course Name
Next we want to fill in the missing values within the course field. As it mentions in the requirements, we want to change the recipe ID so that we can complete the fill-down technique. We can use the following calculation:
Recipe ID
We can then use this to Order our rows based on their course:
From here we just need to do some tidying up before being ready to output the data. We can take the following steps:
1. Remove Order, Order-1, Max Order fields
2. Rename Course-1 to Course
3. Filter where [Course] != [Dish]. This removes any fields that aren't actual dishes
4. Exclude nulls from Selections field. This retains only the selections that each person has chosen.
5. Remove Selections field.
After these changes our table should now to ready to output and look like this: