2024: Week 52 - Naughty or Nice?

 Created by: Carl Allchin

Well another year of Preppin' Data comes to an end with a perfect challenge of whether you are on the naughty or nice list? Santa has received a number of files that even he has been able to union together but needs some help to work out whether each person is on the naughty or nice list. 

Santa has spotted there is a number of names that have been duplicated as records of niceness and naughty deeds have been submitted throughout the year so can you help him solve who should be in each list based on:

  • If a name is only on the nice or naughty list, then that's what list they are part of. 
  • If a name is on both the naughty and nice list, the number of times they feature on each list will determine whether they are naughty or nice. (Whichever list has the most mentions determines the end result)
  • If there is an even split between naughty and nice mentions, the latest mention will determine which list the person will end up on. 
…and there was you thinking Santa just had to work out logistical travel plans and work with the world's leading manufacturers to source the right toys for all the nice children! 

Thanks for taking part in Preppin' and the Preppers wish you all a Happy New Year. 

Input


Requirements

  • Input the data
  • Split the File Paths to determine which list each record is on
  • Create an Index field combing the File Path number and id (id 7 from Naughty 1 file should create an id of 1007) 
  • Create a count of how many naughty listings and nice listings each name has
  • Determine what list each person should be on
    • If the listings are tied, find the latest listing for those people as that will determine which listing they are on
  • Remove any unnecessary fields and create one row per person:
    • Leaves Name and 'Naughty or Nice' field
  • Output the data

Output


2 fields
  • Naughty or Nice
  • Name
4269 rows (4270 including headers)

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