2023: Week 1 - Solution
Solution by Tom Prowse and you can download the workflow here.
It's the first solution post of the year! If you are new to #Preppin' Data then this is where we recap the challenge from the previous week and walk you through how we went about solving it. Each week we will have the blog post and video solution to help you get through the challenge. These might differ slightly but hopefully that will show that there isn't always a 'right' answer but there are many ways of getting to the desired outcome.
Let's get started with the solution!
Step 1 - Split Transaction Code
From here we want to use the '-' as a separator and split off the first set of letters from the string. This contains the bank information so we just want to split off the first 1 fields:
We can then rename that field to Bank and our table should look like this:
Step 2 - Online or In-Person
Next we want to translate the 1 and 0's in the Online or In-Person field. As per the requirements, we want that 1 = Online and 0 = In-Person.
There are a couple of ways to do this, but probably the easiest way is change the Online or In-Person field to a string. You can do this by clicking on the # then selecting String
Now we can update the values in the string to match the corresponding values by double-clicking on each within the Profile pane:
Step 3 - Day of the Week
Within the same step we now want to change our date field to just the day of the week. Again, there are a couple of different ways to do this, but we can utilise the in-built functionality within Tableau Prep to help.
On the Transaction Date field, we can click on the 3 dot menu, then select Convert Dates --> Day of the Week
This will result in our Transaction Date field being changed into a day of the week:
Step 4 - Levels of Detail
This creates our first output:
Output 2 - Total Values by Bank, Day of the Week and Type of Transaction (Online or In-Person)
This time we want to Group By Bank, Online or In-Person, and Transaction Date, then Sum Value:
This results in output 2:
Output 3 - Total Values by Bank and Customer Code
The final aggregation is Grouped By Bank & Customer Code, then Sum Value:
This creates the required table for output 3: