Start Free Trial

Alteryx Designer Desktop Discussions

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

Transposition of values to a limited number of columns

Marceli_Szadowiak
6 - Meteoroid

Hello everyone,

 

I am trying to find an elegant solution to transform customer data table formatted in a single column as in the example below

 

Customer no.Contact typeValue
123Emailabc@email.com
123Emaildef@email.com
123Emailghi@email.com
123Phone111-111-111
123Phone222-222-222
123Phone777-777-777
456Emailjkl@email.com
456Emailmno@email.com
456Phone333-333-333
789Emailprs@email.com
789Emailtuv@email.com
789Emailwxy@email.com
789Emailzzz@email.com
789Phone444-444-444
789Phone555-555-555
789Phone666-666-666

 

to a new table where one customer record can hold up to two phone numbers and only one email address, as below

 

 

Customer no.Phone1Phone2Email
123111-111-111222-222-222abc@email.com
123777-777-777 def@email.com
123  ghi@email.com
456333-333-333 jkl@email.com
456  mno@email.com
789444-444-444555-555-555prs@email.com
789666-666-666 tuv@email.com
789  wxy@email.com
789  zzz@email.com

 

Thanks in advance for help

 

5 REPLIES 5
Gaurav_Dhama_
12 - Quasar

They both look the same. Can you confirm?

Marceli_Szadowiak
6 - Meteoroid

Please check now

Qiu
21 - Polaris
21 - Polaris

@Marceli_Szadowiak 
A bit twist on the Sequence Number arrangement. 😁

0815-Marceli_Szadowiak.jpg

Marceli_Szadowiak
6 - Meteoroid

Thank you, works brilliantly.

Marceli_Szadowiak
6 - Meteoroid

Hello again,

 

now I would like to find a solution for the initial contact input which looks like this:

Customer no.Contact typeValuePrimary account for multiple-account contacts
123Emailabc@email.comYES
123Emaildef@email.comN/A
123Emailghi@email.comN/A
123Phone111-111-111YES
123Phone222-222-222N/A
123Phone777-777-777YES
222Emailabc@email.comNO
222Phone777-777-777NO
222Phone777-777-777NO
333Emailabc@email.comNO
444Emailabc@email.comNO
555Phone777-777-777NO
666Phone111-111-111NO
456Emailjkl@email.comN/A
456Emailmno@email.comN/A
456Phone333-333-333N/A
789Emailprs@email.comYES
789Emailtuv@email.comYES
789Emailwxy@email.comYES
789Emailzzz@email.comYES
789Phone444-444-444YES
789Phone555-555-555YES
789Phone666-666-666YES
999Emailprs@email.comNO
999Emailtuv@email.comNO
999Emailwxy@email.comNO
999Emailzzz@email.comNO
999Phone444-444-444NO
999Phone555-555-555NO
999Phone666-666-666NO

 

The output has to be formatted in accordance with the following rules:

 

1. there can be no duplicate contacts in the output file

2. if a contact (either email or a phone number) is shared by more than one account,  the account indicated as the primary account for that contact is to be retained in the Customer no. column and all the remaining accounts sharing that contact need to be indicated in consecutive Relationship columns.

3. each record can hold 1 email and up to 2 phone numbers. 

Based on the  rules stated above, the output file should look like this:

 

Customer no.Phone1Phone2EmailRelationship1Relationship2Relationship3
123  abc@email.com222333444
123  def@email.com   
123  ghi@email.com   
123111-111-111  666  
123222-222-222     
123777-777-777  222555 
456  jkl@email.com   
456333-333-333 mno@email.com   
789444-444-444555-555-555prs@email.com999  
789 666-666-666tuv@email.com999  
789  wxy@email.com999  
789  zzz@email.com999  

 

Looking forward to hearing your feedback, thanks.

 

Labels
Top Solution Authors