2022: Week 14 - Solution

Solution by Tom Prowse and you can download the workflow here.


This week we revisit one of Jenny's favourite TV shows, Richard Osman's House of Games, and look at if the results would be different if we changed the double points scoring system. 

Step 1 - Keep Relevant Fields

The first step after inputting the data is to only keep the relevant fields that are shown in the requirements. We can do this straight from the input step by using the tick boxes to select only the fields that we require and double clicking to rename any fields: 


Step 2 - Filter

Next we want to filter all of the rows where the Series has a null value or is preceded by a 'N'. First we can select the Null, N1, & N2 values in the profile pane and then exclude these values. We should now have the numbers 1-5 remaining. 

We can also tidy the Rank field at this stage by removing any letters. We can use Tableau Prep's cleaning functionality to help us with this: 



Step 3 - Points with Double Points

The next step is to calculate the new final points if the double points Friday didn't occur. Based on the scoring system we can use this calculation: 

Points without Double Points Friday 
[1st]*4
+
[2nd]*3
+
[3rd]*2
[4th]

Then we can create a new rank based on this calculation to see who has the highest points: 

Rank without Double Points Friday


Then we can calculate if there was any change in the winner: 

Change in Winner? 
IF [Rank]=1 THEN
[Rank without double points Friday]!=[Rank]
END

Then finally we need to identify if there was a change or not for each Series and Week combination: 

Change in winner with no double points Friday 
{ FIXED [Series],[Week] : max([Change in winner?]) }

At this stage our table should look like this: 


Step 4 - Double Score Friday

Next we want to calculate the scenario if the score was doubled on Friday and not just the points. First, we need to calculate the score:

Score if Double Score Friday
[M]+[Tu]+[W]+[Th]+([F]*2)

Then we can rank these new scores:

Rank if Double Score Friday 


Then again we can calculate whether there has been a change in the winner: 

Change in Winner?  
IF [Rank]=1 THEN
[Rank if Double Score Friday]!=[Rank]
END

And then we can calculate this over the whole week and series combination: 

Change in winner if Double Score Friday?
{ FIXED [Series],[Week] : max([Change in winner?]) }

After these set of calculations we need to remove any unrequired fields and we are ready to output the data: 


You can download the full 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

2023: Week 1 The Data Source Bank

2023: Week 2 - International Bank Account Numbers

How to...Handle Free Text