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.

How to duplicate rows with only one column has value?

emmazyan
5 - Atom

Hi all, 

 

I have a table with four columns: the first column is an ID, and the next three columns contain values. I need to duplicate the rows for each ID based on the 3 value columns. For example, if only two columns have data, I need to duplicate it to two rows, with only one column has value. 

 

The input is:

IDValue#1Value#2Value#3
AAA1020 
BBB 2030

 

The output is:

IDValue#1Value#2Value#3
AAA10  
AAA 20

 

BBB 20

 

BBB  

30

 

 

 

Thanks ahead!!!

 

 

 

 

3 REPLIES 3
Carolyn
12 - Quasar
12 - Quasar

Give this a try! What I did:

 

  1. Transpose to get all the values in one column
  2. Filter to exclude nulls
  3. Key part - I used the Multi-Row Tool to create a new column called "Row ID" where I gave each value its own ID
    1. Note - if you have 2024.2, you can just use the Record ID tool with Grouping by the ID field
  4. Cross Tab to put it back together
  5. Sort & Select to order and clean up

 

Step #1 - Transpose:

2024-11-27_10-19-43.png

 

Step #3 - Multi-Row Formula:

2024-11-27_10-19-34.png

 

Result: 

2024-11-27_10-20-04.png

binuacs
21 - Polaris

@emmazyan another approach using tile tool

image.png

Carolyn
12 - Quasar
12 - Quasar

@binuacs - As I was working on mine, I said "I think the Tile Tool is going to be in someone else's answer" - I'm not great at it and need to spend some time figuring it out :)

Labels