+ Reply to Thread
Results 1 to 13 of 13

Power Query: transpose data related to same ID in row

  1. #1
    Registered User
    Join Date
    02-20-2023
    Location
    Baykonur
    MS-Off Ver
    Office 1-2-3
    Posts
    4

    Power Query: transpose data related to same ID in row

    Hallo All,

    I have a "small" problem in PQ. I have in column product IDs and in another column all EAN codes related to each article (product ID). It naturally means when I have 5 EANs related to one product, the mentioned products is in 5 lines.
    Desired outcome would be: Each product ID is in one (1) row and Query transpose thos 5 codes in new columns (there is not more than 5 EANs to each code).
    Using transpose in PQ however transpose all codes (as they are unique) to adequate number of the columns .
    PLease see details in attached table.

    Thank you in advance.
    Attached Files Attached Files
    Last edited by tachnapka; 04-19-2023 at 05:14 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,933

    Re: Power Query: transpose data related to same ID in row

    Welcome to the forum.

    What is Office 1-2-3?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Power Query: transpose data related to same ID in row

    Product Article ID EAN.1 EAN.2
    55a62da4-4f82-4fc4-afbc-c3fbdc40e1d2 8591454005939
    b04fa022-79bc-41ae-860b-b81cf33385b9 5703538244988
    d9e60527-9dff-4982-ad3f-1630ffa30386 5703538245244
    f596abca-e6bf-4527-b687-476a16565017 5713571000205 5713571000212
    517e03c6-432f-4bd8-9796-e9974f2f8b05 5703538759819
    e7176d60-a687-4f06-aa94-114e4b355e0b 5703538759499 5703538755903
    6b2723e9-b36f-457e-8b39-9ffac835be7d 5703538759994 5703538759970
    c9182c83-761d-4380-a867-42744ef5930d 5703538759697
    ae87520b-2a1c-443f-a8cc-2c07a82c2652 5703538759215
    51fc53ea-5286-4591-abf8-170c7559a6c1 5713571001219 5713571001202


    Please Login or Register  to view this content.
    do not use automatic Change Type
    Last edited by sandy666; 04-17-2023 at 01:18 PM.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,915

    Re: Power Query: transpose data related to same ID in row

    You can do it by grouping on product and adding an index column to the created table, then expand the table back out and pivot on the index. M code would be something like:

    Please Login or Register  to view this content.
    Sample attached.
    Attached Files Attached Files
    Rory

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Power Query: transpose data related to same ID in row

    or if there is no more than 5 EANs
    Please Login or Register  to view this content.
    Product Article ID EAN.1 EAN.2 EAN.3 EAN.4 EAN.5
    55a62da4-4f82-4fc4-afbc-c3fbdc40e1d2 8591454005939
    b04fa022-79bc-41ae-860b-b81cf33385b9 5703538244988
    d9e60527-9dff-4982-ad3f-1630ffa30386 5703538245244
    f596abca-e6bf-4527-b687-476a16565017 5713571000205 5713571000212
    517e03c6-432f-4bd8-9796-e9974f2f8b05 5703538759819
    e7176d60-a687-4f06-aa94-114e4b355e0b 5703538759499 5703538755903
    6b2723e9-b36f-457e-8b39-9ffac835be7d 5703538759994 5703538759970
    c9182c83-761d-4380-a867-42744ef5930d 5703538759697
    ae87520b-2a1c-443f-a8cc-2c07a82c2652 5703538759215
    51fc53ea-5286-4591-abf8-170c7559a6c1 5713571001219 5713571001202
    Last edited by sandy666; 04-17-2023 at 01:18 PM.

  6. #6
    Registered User
    Join Date
    02-20-2023
    Location
    Baykonur
    MS-Off Ver
    Office 1-2-3
    Posts
    4

    Re: Power Query: transpose data related to same ID in row

    Dear sandy666 and rorya.
    It works! I am a big admirer....
    Thank you very much.

    Ch.

  7. #7
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Power Query: transpose data related to same ID in row

    You are welcome




    if the problem is solved, make us happy and hit Add Reputation (bottom left corner next to the post that was helpful)
    and then mark the thread as SOLVED (top above your first post - Thread Tools)
    Last edited by sandy666; 04-17-2023 at 07:43 AM.

  8. #8
    Registered User
    Join Date
    04-17-2023
    Location
    ahmedabad
    MS-Off Ver
    2007
    Posts
    1

    Re: Power Query: transpose data related to same ID in row

    thank you for the solution
    Best Data science course in Ahmedabad

  9. #9
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,294

    Re: Power Query: transpose data related to same ID in row

    rorya-error
    sandy666-error
    Attached Files Attached Files

  10. #10
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Power Query: transpose data related to same ID in row

    Quote Originally Posted by Czeslaw View Post
    rorya-error
    sandy666-error
    Czeslaw - error

  11. #11
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,294

    Re: Power Query: transpose data related to same ID in row

    Power Query
    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,294

    Re: Power Query: transpose data related to same ID in row

    rorya and sandy666
    sorry i was wrong

  13. #13
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Power Query: transpose data related to same ID in row

    Quote Originally Posted by Czeslaw View Post
    rorya and sandy666
    sorry i was wrong
    ......................
    I knew

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Transpose List in power query
    By JyothiGrace in forum Excel General
    Replies: 2
    Last Post: 07-01-2022, 08:45 AM
  2. Replies: 2
    Last Post: 11-12-2021, 03:44 AM
  3. Power Query grouping of related items to find earliest datetime
    By Marbleking in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-08-2021, 03:44 AM
  4. Power Query - Transpose Specific Columns
    By keith6292 in forum Excel General
    Replies: 1
    Last Post: 07-20-2021, 04:01 PM
  5. [SOLVED] Transpose values Power Query
    By JyothiGrace in forum Excel General
    Replies: 2
    Last Post: 07-19-2021, 08:48 AM
  6. Replies: 10
    Last Post: 06-25-2020, 12:19 AM
  7. Need a solution for power query related work
    By jones143 in forum Excel General
    Replies: 0
    Last Post: 05-16-2020, 02:32 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1