Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #49: Reformatting Transactional Data

GeneR
Alteryx Alumni (Retired)

The link to last week’s challenge is HERE.

 

This week’s exercise is another example of how Alteryx can take poorly formatted data such as transactional log files and turn it into usable data.

 

Use Case:  A customer has some data that comes with key product information stored at the top of the file.  Each data column contains three lines of header information per product (product, market and type).  The customer wants this information to be shown in rows for each product.

 

Objective:  Reformat the input data to match the output example.

 
Joe_Mako
12 - Quasar
Spoiler
Weekly 50.png
MichelKars
6 - Meteoroid
Spoiler
Exercise 50.PNG

My solution slightly different but gives the same results. 

 

TaraM
Alteryx Alumni (Retired)

A solution has been posted (it looks just like yours @Joe_Mako). Thanks for sharing yours too, @MichelKars.

Spoiler
2016-11-21 08_44_49-Alteryx Designer x64 BETA - DataPrep_ReformattingData_Solution.yxmd.png
Tara McCoy
DanielUpton
9 - Comet
Spoiler
Weekly Challenge 49 Alt Submission.png

 ...and here's another alternative with a hard-coded shortcut.  Only works insofar as 1-to-1 relationship between Product, Market and Type remains valid.

 

 

DanielUpton
9 - Comet

Michael, I like the simplicity of your solution.  Any chance I could see the .yxmd?  I'm at dupton@decisionlab.net.  My solution (just posted) also works, but uses hard-coding based on observed values...

JoeM
Alteryx Alumni (Retired)

@DanielUpton, with our latest release of Community, you can now upload solutions right into the thread and no longer have to share just via spoilers! 

DanielUpton
9 - Comet

@JoeM Okay, here is an alt solution.

 

 

mceleavey
17 - Castor
17 - Castor

I think my solution is the same as some others.

Spoiler
I separated the input into two streams by using the sample tool to select the first three rows, and skip the first three rows respectively.
I then used the Transpose and Crosstab tools to pivot the data into the correct format, using the first three rows as a reference file. This was then linked back on the header type:


Solution.PNG




 

 



Bulien

SeanAdams
17 - Castor
17 - Castor

very similar to all the others.    Seems that this may be the natural choice (given that so many folk arrived at this independantly)