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 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!
Created by: Carl Allchin Welcome to a New Year of Preppin' Data challenges. For anyone new to the challenges then let us give you an overview how the weekly challenge works. Each Wednesday the Preppin' crew (Jenny, myself or a guest contributor) drop a data set(s) that requires some reshaping and/or cleaning to get it ready for analysis. You can use any tool or language you want to do the reshaping (we build the challenges in Tableau Prep but love seeing different tools being learnt / tried). Share your solution on LinkedIn, Twitter/X, GitHub or the Tableau Forums Fill out our tracker so you can monitor your progress and involvement The following Tuesday we will post a written solution in Tableau Prep (thanks Tom) and a video walkthrough too (thanks Jenny) As with each January for the last few years, we'll set a number of challenges aimed at beginners. This is a great way to learn a number of fundamental data preparation skills or a chance to learn a new tool — New Year...
Created by: Carl Allchin Welcome to a New Year of Preppin' Data. These are weekly exercises to help you learn and develop data preparation skills. We publish the challenges on a Wednesday and share a solution the following Tuesday. You can take the challenges whenever you want and we love to see your solutions. With data preparation, there is never just one way to complete the tasks so sharing your solutions will help others learn too. Share on Twitter, LinkedIn, the Tableau Forums or wherever you want to too. Tag Jenny Martin, Tom Prowse or myself or just use the #PreppinData to share your solutions. The challenges are designed for learning Tableau Prep but we have a broad community who complete the challenges in R, Python, SQL, DBT, EasyMorph and many other tools. We love seeing people learn new tools so feel free to use whatever tools you want to complete the challenges. A New Year means we start afresh so January's challenges will be focused on beginners. We will u...
Free isn't always a good thing. In data, Free text is the example to state when proving that statements correct. However, lots of benefit can be gained from understanding data that has been entered in Free Text fields. What do we mean by Free Text? Free Text is the string based data that comes from allowing people to type answers in to systems and forms. The resulting data is normally stored within one column, with one answer per cell. As Free Text means the answer could be anything, this is what you get - absolutely anything. From expletives to slang, the words you will find in the data may be a challenge to interpret but the text is the closest way to collect the voice of your customer / employee. The Free Text field is likely to contain long, rambling sentences that can simply be analysed. If you count these fields, you are likely to have one of each entry each. Therefore, simply counting the entries will not provide anything meaningful to your analysis. The value is in ...