Challenge #25: Creating Merchant Combos
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The link to last week’s challenge (challenge #24) is HERE.
As we have said before, restructuring poorly formatted data is one of the most common Alteryx use cases. This week’s challenge is another real world example of a data problem faced by one of our customers.
Use Case: A credit card company’s customer Data is structured so that each row of data contains the merchants each customer has visited in a given week. The credit card company is wanting to understand the correlation of merchants visited by customer. For example: if a customer visit 7-11 what other stores do they have a high propensity to visit?
Objective: Restructure the data into rows that pair merchants together by customer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Could these be posted in 10.1 format for a while? I know 10.5 came out last week, but haven't had a chance to upgrade yet.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You could open the YXMD file in word pad or another text editor and in the header change 10.5 to 10.1 it should open for you then.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
The speed in which you can prototype, test and modify your workflow to achieve your desired result is one of many reasons Alteryx is so darn cool and useful. I tackled this problem in 2 different manners. The fixed format solution assumes you will only have 5 columns of merchant data. The second solution will let you scale to allow for more columns of merchant data to be added without having to modify the workflow. To test my assumptions, I added a new column of data and it worked perfectly. As a way to use a tool I hadn’t used before, I threw the results from the first example into the Contingency Table tool from the Data Investigation tool category to create a matrix style chart to view the data from a different analytical perspective.
Fixed Format
Homemade Table
From Contingency Tool
Solution that scales for multiple scenarios
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
slightly different solution to the others provided - trick used is...
Put a unique ID on each
Then do a cartesian join and...
filter out all combinations where the left ID < the right ID (to eliminate X-X joins or the issue where you have X-Y as well as Y-X - i.e. the symmetrical version of a good row)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
My solution. Results are slightly different because it made more sense to me to have the single vendors show up as Merchant1 instead of Merchant2... but other than that, results match. This was a fun one! Slightly bizarre... and I can decide if I'm pleased by the solution or mildly confused by it. But at least I'm fairly certain my final solution should be adaptable to varying #'s of merchants.
2. Remove Merchant from column name, and then use Multi-Field tool to match if CurrentFIeldName > RowCount, put results in new field named as column # with Merchant2 as suffix.
3. Transpose, Key field = UserID
4. Add "Merchant1" to fields not already containing Merchant2 in values
5. RegEx parse Merchant (1 or 2) and MatchOrder (prefix)
6. Join Data to itself by UserID/RowCount/Merchant
7. Filter + Formula + Unique + Summarize tools combine to get rid of duplicates
8. Sort & Select to remove unwanted columns
Phew!