Alteryx Designer Desktop Discussions

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

'Outer product' of a list of values

AKB
8 - Asteroid

Suppose we have 3 records, with values 1, 2 and 5 (say). I'd like to expand this, adding a new field, so that every combination of the original values is made, like this:

 

1  1

1  2

1  5

2  1

2  2

2  5

5  1

5  2

5  5

 

Is there a way to do this?  Note that the original list length may vary. Thx - 

4 REPLIES 4
DataNath
17 - Castor

Hey @AKB, for this you just need to use an Append Fields tool and append the data to itself. Be mindful that this will of course blow up your data, especially if you do start with a large number of records.

AKB
8 - Asteroid

Hi DataNath,

 

That works well, thank you. My data actually consists of many such lists, each different, and each list shall only be appended to itself, that is, in a GroupBy fashion. If we appended everything without grouping, things would blow up as you mention.

 

The Append Fields Tool has no GroupBy functionality. Can you see a way to do such an append?

 

Thx again - 

DataNath
17 - Castor

@AKB do you have a key that links these sets of records? If so, you could just do a self-join instead of an append. Just do the join on the linking field(s).

AKB
8 - Asteroid

Thank you again, that works well, using the key as you suggest.

Labels