Results 1 to 13 of 13

Power Query: transpose data related to same ID in row

Threaded View

  1. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,968

    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:

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Product Article ID", type text}, {"EAN", type text}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"Product Article ID"}, {{"AllData", each Table.AddIndexColumn(_,"Index",1,1), type table}}),
        #"Expanded AllData" = Table.ExpandTableColumn(#"Grouped Rows", "AllData", {"EAN", "Index"}, {"EAN", "Index"}),
        #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Expanded AllData", {{"Index", type text}}, "en-GB"), List.Distinct(Table.TransformColumnTypes(#"Expanded AllData", {{"Index", type text}}, "en-GB")[Index]), "Index", "EAN")
    in
        #"Pivoted Column"
    Sample attached.
    Attached Files Attached Files
    Everyone who confuses correlation and causation ends up dead.

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