community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcement | Get certified today - take the Alteryx Designer Core and Advanced exams on-demand now!
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Weekly Challenge
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Unable to display your progress at this time. Please try again a little later, or contact an administrator if you continue to see this error.

Challenge #35: Data Cleansing Practice

Highlighted
Alteryx Alumni (Retired)

The link to the solution for last challenge #34 is HERE.  For this challenge let’s practice some data cleansing.

 

Use Case:  There is a series of data cleansing processes we need to do on our data. Please solve each per the instructions.

Objective:

  1. Remove leading zeroes
  2. Trim leading zeroes and/or descriptive text at the end
  3. If the data value ends with ID, remove the ID
  4. If more than 8 chars, remove anything after 8. If only 6, add “SC” to the front.
Community Data Engineer
Community Data Engineer

Here's a solution:

Spoiler
Exercise 35 Solution.PNG
Alteryx Certified Partner

My solutions. 

 

1. Remove Leading Zeros.

For this, given the codes we are looking for are 4 digit numeric codes, I simply converted to a numeric field. This automatically drops the leading zeros:

 

Remove leading zeros.PNG

2. Isolate 4 digit numeric code.

Here, I simply used Text to Columns to split the columns on ":". I then dropped the superfluous columns:

 

Isolate 4 Digit Code.PNG

 

3. Remove "SD" from the end of any records on which it appears.

 

This was achieved by simply using the "Trimright()" function to remove any instances of "SD":

 

Trim SD from the end of a string.PNG

 

4. Return 8 character string and add "US" to the start of strings that are shorter than 8 characters.

 

I used a simple IF statement to determine the records that were shorter than 8 characters, and if so, add the characters "US" to the beginning. This was coupled with a left() function to return the 8 character string:

 

Trim to 8 Characters and add US.PNG

 

5. Return 5 digit code rather than descriptions on given codes.

 

Here, I used the join tool to join "SBU Code" in the input data stream to the "Description" field in the source table. The left output returns the correct three codes. The output of the join shows those records where the code is in the description field. Rename this output and union back to the input stream to return all records correctly:

 

Isolate 5 digit codes.PNG

 

 

Alteryx Partner

Here's my solution for this challenge.

Spoiler
000002.png
Asteroid
 

Hi Syfer,

 

You're close.

 

I realigned your columns in the union join which returned the correct result.

 

Spoiler
syfer889fix.png

- Matt

Asteroid

Hi @GeneR ,

 

Here is my solution. 

 

Best Regards,

Samuel

 

Alteryx
Alteryx

Not sure what's going on with this challenge. None of the replies I'm seeing line up with the current version of the question. Here's my solution.

Quasar

Redone.

Asteroid

This challenge was so difficult that barely anyone in the last few years have been able to solve it! :P