Forum Discussion

AndrewGBale's avatar
AndrewGBale
New Member
4 years ago

Transform several groups of columns

I have a row of data describing an order - first several columns on a customer, then 4 columns on product 1, 4 columns on product 2, etc up to 15 products.

 

I need to transform this into one row per product, each row consisting of the same customer data, and the 4 columns for the product.

 

So if the customer had 3 products in their order, there would be 3 rows, the first for product 1, the second for product 2 etc. each with the same first columns describing the customer.


Am drawing a blank on this conversation.  Any assistand gladly received!!

4 Replies

  • Hi,

    How are the product columns named? Are they of the form, for example:

    "Product 1 Name", "Product 1 ID", "Product 1 Qty", "Product 1 Cost"
    "Product 2 Name", "Product 2 ID", "Product 2 Qty", "Product 2 Cost"

    ...

    etc., so basically identical apart from the product name?

    Regards

  • Anonymous's avatar
    Anonymous
    Not applicable

    I would select all of the Cistomwr columns, then click "Unpivot Other Columns".

     

    --Nate

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi AndrewGBale ,

     

    Try to use unpivot

     

     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi AndrewGBale ,


    Could you tell me if your problem has been solved?
    If it is, kindly Accept it as the solution. More people will benefit from it.
    Or you are still confused about it, please provide me with more details about your problem.


    Best Regards,
    Stephen Tao