Alteryx Designer Desktop Discussions

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

Using Generate Rows to Duplicate Rows Without a Suffix and Then Add Suffix As Needed

Anthony_A2
5 - Atom

Hi All,

 

This is my first time using the generate rows tool and I could use some help. Essentially I have a table where the column "Key 2" has some records that contain the suffix -A,-B,-C and some that do not. I would like to duplicate my rows without a suffix and add the missing suffix on. 

 

To break down what I want to do: IF the last two characters in Key 2 does not contain -A,-B, or -C then duplicate that row and add -A, -B, and -C to those rows as needed. 

 

If my original table is:

Key 1Key 2
A1ABC-A
A1ABC-B

A1

ABC-C

B2

CBA

B2

CBA-A

C3

ZZZ

D4

DDD

 

I want to go to:

Key 1Key 2
A1ABC-A
A1ABC-B

A1

ABC-C

B2

CBA

B2

CBA-A

B2

CBA-B

B2

CBA-C

C3

ZZZ

C3

ZZZ-A

C3

ZZZ-B

C3

ZZZ-C

D4

DDD

D4

DDD-A

D4

DDD-B

D4

DDD-C

 

I feel like this is a generate rows function and I'm having trouble figuring out the syntax/setup. Let me know if you have any ideas!

2 REPLIES 2
atcodedog05
22 - Nova
22 - Nova

Hi @Anthony_A2 

 

Here is how you can do it. I am creating the comibations and keeping only single occurence.

Workflow:

atcodedog05_0-1630591546715.png

 

Hope this helps : )

 

Luke_C
17 - Castor

Hi @Anthony_A2 

 

Here's my solution to this:

 

  1. Use formula to remove suffixes in original data
  2. Summarize to get unique values
  3. Append A, B, C to all records
  4. Join and union to get all combos

 

Luke_C_0-1630592026526.png

 

Labels