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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
relentless226
Regular Visitor

Combining multiple values from single column into one row/record

Hello:

 

I am working in PowerQuery/Transform within Power BI.  My table currently looks like the following- I have some customers with two sales people assigned and this creates issues in my visuals (a table visual right now) as I only want one row per customer:

Customer IDCustomer NameSales Person
111Jones ManufacturingJohn Smith
111Jones ManufacturingJane Doe
   

 

What I would like to do is end up with one row for the rows above and concatenate the sales person's names together with an & between them in a custom column so I have something like this:

 

Customer IDCustomer NameSales People
111Jones ManufacturingJohn Smith & Jane Doe

 

I know this is probably pretty simple but I appreciate any help I can get!

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Here's one way to do it in the query editor with a custom Group By step.  To see how it works, just create a blank query, open the Advanced Editor and replace the text there with the M code below.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ0VNJR8srPSy1W8E3MK01LTC4pLcrMSweLZuQpBOdmlmQoxeoQUJqYl6rgkp+qFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Customer ID" = _t, #"Customer Name" = _t, #"Sales Person" = _t]),
    #"Grouped Rows" = Table.Group(Source, {"Customer ID", "Customer Name"}, {{"SalesPerson", each Text.Combine([Sales Person], "&"), type text}})
in
    #"Grouped Rows"

 

Pat





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

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

1 REPLY 1
mahoneypat
Microsoft Employee
Microsoft Employee

Here's one way to do it in the query editor with a custom Group By step.  To see how it works, just create a blank query, open the Advanced Editor and replace the text there with the M code below.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ0VNJR8srPSy1W8E3MK01LTC4pLcrMSweLZuQpBOdmlmQoxeoQUJqYl6rgkp+qFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Customer ID" = _t, #"Customer Name" = _t, #"Sales Person" = _t]),
    #"Grouped Rows" = Table.Group(Source, {"Customer ID", "Customer Name"}, {{"SalesPerson", each Text.Combine([Sales Person], "&"), type text}})
in
    #"Grouped Rows"

 

Pat





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

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors