2024: Week 7 - Solution
Solution by Tom Prowse and you can download the workflow here.
The challenge this week is a themed one all about Valentines day! We want to match up some couples and what gifts they receive based on the length of their relationship.
Step 1 - Number of Valentines
First we want to use the Couples input to calculate how many valentines days a couple has been together. After inputting the data we can make sure that the Start date has the correct data type - from a string to a date type. Then we can create a Valentine's day for 2024 by creating a new date field:
Valentine's Day 2024
MAKEDATE(2024,2,14)
Now we have these two dates we can then create a new row for each of the Valentine's by using the New Rows step:
Then we can filter for only Valentine's days by filtering for February and the 14th:
(MONTH([NewRows1]) = 2)
AND
(DAY([NewRows1]) = 14)
Then use an aggregation to count the number of rows per couple:
At this stage our table should look like this:
Step 2 - Combine Gifts
We can now include the Gifts input and then clean the year field by removing the letters and then changing the data type to a number.
Then we can join this table to our existing workflow by using an inner join where Number of Valentine's = Year:
We can then remove the year field and we are ready to output our table:
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!