Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
EaglesTony
Post Prodigy
Post Prodigy

How can I combine on a group by ?

hi,

 

  I have the following:

 

  Application Code    Info

  401                          Doe, John|

  401                          Doe, Jane|

  402                          Trust, Frank|

 

I need it:

 

  Application Code    Info

  401                          Doe, John|Doe, Jane|

  402                          Trust, Frank|

 

I'm thinking a group by as some sort ?

1 ACCEPTED SOLUTION
SundarRaj
Super User
Super User

Hi @EaglesTony 
while grouping, you can simply pull the column that you want _[ColumnName] which will convert it into a list. Post this, just wrapping it around Text.Combine() shall do the trick. Thanks

SundarRaj_0-1754118939203.png

 

Sundar Rajagopalan

View solution in original post

4 REPLIES 4
SundarRaj
Super User
Super User

Hi @EaglesTony 
while grouping, you can simply pull the column that you want _[ColumnName] which will convert it into a list. Post this, just wrapping it around Text.Combine() shall do the trick. Thanks

SundarRaj_0-1754118939203.png

 

Sundar Rajagopalan
ronrsnfld
Super User
Super User

Use Table.Group with a custom aggregation (write it in the Advanced Editor):

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjEwVNJRcslP1VHwys/Iq1GK1UEVTMxLhQkaAQVDikqLS3QU3IoS87KB4rEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Application Code" = _t, Info = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Application Code", Int64.Type}, {"Info", type text}}),
    
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Application Code"}, {
        {"Info", each Text.Combine([Info],""), type text}})
in
    #"Grouped Rows"

Original

ronrsnfld_0-1754097625853.png

Result

ronrsnfld_2-1754097861902.png

 

 

 

Note that if your original data did not have the vertical bar at the end of each name, you could use that as the delimiter in the Text.Combine function.

bhanu_gautam
Super User
Super User

@EaglesTony 

 

 

In Power Query Editor, select the "Application Code" column.
Go to the "Home" tab and click on "Group By".
In the Group By dialog, set the following:
Group by: "Application Code"


New column name: "Concatenated Info" (or any name you prefer)
Operation: "All Rows" (this will create a table for each group)


Concatenate the Info:

 

After grouping, you will have a new column with tables. Click on the small expand icon in the header of this new column and select "Info" to expand it.
Add a custom column to concatenate the "Info" values. Go to "Add Column" > "Custom Column" and use the following formula:

     Text.Combine([Info], "|")


This will concatenate all "Info" values for each "Application Code" with a "|" separator.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






I tried this and created the new column as "Info":

EaglesTony_0-1754055942371.png

I then expanded this, and added this:

EaglesTony_2-1754056126633.png

 

But I get an error:

Expression.Error: We cannot convert a value of type Table to type List.
Details:
Value=[Table]
Type=[Type]

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors