2024: Week 25 - Solution


Solution by Tom Prowse and you can download the workflow here


Step 1 - Split Complaint Description

First we want to work on the Complaints data source and then parse the Complaint Description into the Product ID, Issue Type, and the Description.

Product ID 
The product ID is the first set of numbers and letters before the '-' symbol. For this we can use a split to split only the first occurrence before the '-' and leave the remaining text in a separate field: 



This leaves us with the Product ID and the remaining text in separate columns, and we can then remove the original Complaint Description field: 


Issue Type 
Next from the remain text we can extract the issue type. For this we want to use the ':' as the separator: 



Then we can rename this field and remove the original split field: 



Complaint Description 
Finally we can extract the Description in a nice format by removing the ' " ' from either end. For this we can use two splits, and make sure that we are using the " as a separator



We can then tidy the table up by removing any additional fields and renaming the split field to Complaint Description: 



Step 2 - Category Code

In order to combine the two data sources we need to create a Category code for each table. On the existing Complaints workstream we need to extract the first two letters from the Product ID so we can use a Left function for this: 

Category Code 
LEFT([Product ID],2)


We can do the same with the Categories data source but we also need to ensure that it is all upper case: 

Category Code 
UPPER(LEFT([Product Category],2))

We can now join both tables using an inner join on the category code field: 




Step 3 - Filter Dates

The final step is to make sure we are only looking at dates where the Date Resolved happens after the Date Received. 

For this we need to ensure that the Date Resolved and the Date Received fields both have the data type of a Date. 

We can then use a calculated field within a filter to make sure we are filtered to only where [Date Received]<=[Date Resolved]

After removing any unneeded fields the output should look like this: 



You can view the output here.

After you finish the challenge make sure to fill in the participation tracker, then share your solution on Twitter using #PreppinData and tagging @Datajedininja@JennyMartinDS14 & @TomProwse1

You can also post your solution on the Tableau Forum where we have a Preppin' Data community page. Post your solutions and ask questions if you need any help! 

Popular posts from this blog

2024: Week 1 - Prep Air's Flow Card

2023: Week 1 The Data Source Bank

How to...Handle Free Text