Expand my Community achievements bar.

How to transpose data in AEP

Avatar

Level 2

Hi All,

Can you please help me in finding a way to transpose the data from different columns into a single for a customer. 
here is the data
Customer id                Product purchase 

101                                   abc

101                                    vcb

101                                     kiu

101                                    xyz

 

We want the data to get converted like this

customer id            Product purchase_1  Product purchase_2   Product purchase_3  

101                            abc                                 vcb                             kiu

3 Replies

Avatar

Level 3

Hi @akanshamishra1 , 

 

There are two options to do this:

 

1) Do this pivot outside of AEP and then bring the data into AEP. Use can use tools like SQL Server or Excel to do this and produce the correct csv file to import the data into AEP.

2) If option 1 is not possible and you already have data present in a dataset in AEP then you can use query service to pivot this data and insert this pivoted data into a new dataset in AEP.

 

Cheers,

Prateek

Avatar

Community Advisor

based upon the scenario provided I think you should transform the product purchase into an array based upon a single customer Id.  

 

I would recommend using the to_array function within dataPrep

https://experienceleague.adobe.com/docs/experience-platform/data-prep/functions.html?lang=en#arrays

Avatar

Administrator

@akanshamishra1 Did you find the suggested solutions helpful? It would be great if you can  mark the answer as correct for posterity. If you have found out solution yourself, share it with wider audience in the community.