Missed the Q4 Fall Release Product Update? Watch the on-demand webinar for more info on the latest in Designer 24.2, Auto Insights Magic Reports, and more!
Free Trial

Alteryx Designer Desktop Discussions

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

Sort sequential strings into groups

polar23
5 - Atom

I am trying to combine rows into as few groups as possible. Up to 7 rows can become part of the same group of frequencies 1-7, but only within the same product type (column A). Each group does not need to have a complete sequence of 1-7, but no digit in column B can be repeated within a single group.

 

Example: A12345 can be grouped with A6 and A7, but it can’t be grouped with B67 or A56.

 

My input is only columns 1 and 2. My desired output is columns 3 and 4 appended to the original table, with column 3 as the Group # and column 4 as the Product+Group ID.

 

Sample data:

Product

Frequency

Group

ID

A

1234567

1

A1

A

123457

2

A2

A

12345

3

A3

A

6

2

A2

A

6

3

A3

A

6

4

A4

A

7

3

A3

B

1234

1

B1

B

67

1

B1

B

6

2

B2

 

Any suggestions are appreciated! Please let me know if I can clarify anything.

1 REPLY 1
MatthewO
Alteryx Alumni (Retired)

@polar23 I was able to replicate the desired output leveraging an Iterative Macro. The packaged workflow, including the macro, is attached. I hope this is helpful for you!

 

Labels
Top Solution Authors