2022: Week 44 - Creating Order IDs

 Challenge by: Jenny Martin

When I started out in the data world, I had some naïve assumptions. For instance, I thought all datasets would come with a unique identifier. Unfortunately, I've since worked with many datasets where this has not been the case! Whilst it will depend on the data structure as to how you choose to work around this, for this challenge we'll we using a combination of 2 fields to create a unique identifier. 

The idea for this challenge came from a member of DS35 Stephen, in his second week of training. He found a creative way to recreate the padleft function from Alteryx in Tableau Prep! Keep your eyes peeled for a full challenge created by Stephen in the near future!

Input

Our input this week contains duplicate Order Numbers. However, they belong to different Customers, so let's use a combination of these fields to create an Order ID. 
 

Requirements

  • Input the data
  • Aside from our Order Number issue, you'll notice we have 3 fields for Order Dates. Bring these together into a single field
  • We want our new Order IDs to have the following structure:
    • The first 2 characters should be the Customers initials
    • The last characters should be the Order Number
    • If necessary, there should be 0's in between to create 8 characters for the Order ID length
      • For example: AJ000746
  • Output the data

Output


  • 4 fields
    • Order ID
    • Order Number
    • Customer
    • Order Date
  • 1000 rows (1001 including headers)
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