community
cancel
Showing results for 
Search instead for 
Did you mean: 
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.
Getting started with Designer? | Start your journey with our new Learning Path!

Challenge #25: Creating Merchant Combos

Alteryx Alumni (Retired)

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.

Quasar
Quasar

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.

Alteryx Alumni (Retired)

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.

Creative Director
Creative Director

Hi @dataMack - I've uploaded a 10.1 version. As @GeneR points out, you need only change the version in a text editor. In this case you need to specify 10.0 though.

Tara McCoy
Bolide

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

Spoiler
The 2 extra tails are there to visualize the results in a table vs. a list

week25wf1.PNG
Homemade Table
wk25c1.PNG

From Contingency Tool
wk25c2.PNG

Solution that scales for multiple scenarios

Spoiler

week25wf2.PNG
Highlighted
Creative Director
Creative Director

A solution has been uploaded, suitable for version 10.1

Spoiler
2016-05-16 09_27_42-Alteryx Designer x64 - Analytics_CreatingMerchantCombos_Intermediate_Solution.yx.png
Tara McCoy
Asteroid
Spoiler
Capture.JPG
Alteryx Certified Partner
Alteryx Certified Partner

@JoeM,

 

I was puzzled why all combinations of store visits were not used.  Anyways, I solved for the answers provided.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Nebula
Nebula

slightly different solution to the others provided - trick used is...

 

Spoiler
Only keep unique merchants by user
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)

Magnetar
Magnetar

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. 

 

 

Spoiler
1. Generate Rows based on Count for each UserID
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!

WeeklyChallenge25.JPG