Forum Discussion

PeteyG's avatar
PeteyG
Helper I
5 months ago
Solved

Grouping rows by Column and then updating Column

I am trying to group all the rows below together and then have all the Built column separated by a comma.  I tried "Group By" but it gets rid of a bunch of my columns and having issues with the comma...
  • jennratten's avatar
    5 months ago

    Hi PeteyG  - thanks for posting in the Fabric Community. Please review the solution below and let me know if you have any questions.

    When you group table data in Power Query, the columns in the original table become lists.  We can see this by choosing the Group By option from the UI menu, selecting Sum, Average, Min or Max as the operation and then looking at the script generated. (The last three create table functions because they are looking at the table rather than just one selected column).

     

     

    If we choose Max, for example, we see:

     

    Now that we know we are dealing with the column as a list, we can use Text.Combine, which creates delimited text from a list.

    = Table.Group(#"Changed Type", {"Vehicle  ", "Color  ", "Int Color  ", "Doors  ", "Year  ", "Seating  "}, {{"Built", each Text.Combine ( [Built], "," )}})

     

    If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.

    Proud to be a Microsoft Fabric Super User