Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Create a matrix of all possible combinations

crunyeon
7 - Meteor

Hi Everyone - I have a list of capabilities, and each one can have a value of High, Med, or Low.  I'm trying to create a matrix with the capabilities as the columns, and the rows containing all of the possible H,M, L combinations.  For example, if I have the following capabilities:

 

  • Business Process Automation
  • Data & Analytics
  • Enterprise Business Solutions

I would like to create a table that looks something like this:

 

Business Process AutomationData & Analytics

Enterprise Business Solutions

High

HighHigh
MedHighHigh
LowHighHigh
HighMedHigh

 

Etc...

 

Does anyone know if this is possible in Alteryx?  If so how would I go about creating it?

 

Thank you in advance for any help you can provide.

4 REPLIES 4
BenMoss
ACE Emeritus
ACE Emeritus

Hi!

 

This is a fun challenge.

 

I've used an iterative macro to build the solution you require! Check this out.

 

Ben

crunyeon
7 - Meteor

Hi Ben - thank you so much! This worked perfectly!

patrick_digan
17 - Castor
17 - Castor

@crunyeon For what it's worth, some simple R code can also be used to do the trick. I've just adapted @JohnJPS's solution to this post.

 

df <- as.data.frame(read.Alteryx("#1", mode="data.frame"))
df1 <- expand.grid(split(df$Field1, df$Field2))
write.Alteryx(df1, 1)

Lines 1 and 3 are just moving the data in and out of R, and line 2 is doing all the work.

Capture.PNG

 

gavin_data
6 - Meteoroid

How would you adjust this to only create records for unique combinations?

 

For example: only one record for the below two would be created since they are the same combination but just in a different order? I have Customer IDs and Products and am trying to build something that shows every unique combination of products that customers have purchased. My community post has what I'm looking to solve.

HighMedium

High

HighHighMedium

 

 

Thanks! 

Labels