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
brdrok
Helper I
Helper I

Merge two rows into a single row

Hi,

I hope that someone can help me with the following issue.  I am trying to merge two or more rows into a single row based on a key column.  Hopefully the image below can show it better than I can explain it:

 

brdrok_0-1754662703313.png

In the picture above, I would like to create one single row for AccountKey 16410 and have the InvestorTotaling be merged into a single row.

 

Thank you

1 ACCEPTED SOLUTION

Hi,

Upload the file to Google Drive/One Drive and share the download link here.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

9 REPLIES 9
Aburar_123
Solution Supplier
Solution Supplier

Hi @brdrok ,

You can try it with Concatenatex() function as below

Aburar_123_0-1756793845428.png

 

v-tejrama
Community Support
Community Support

Hi @brdrok ,


After performing group by → accountkey with the operation set to all rows, you'll see a column displaying “table” for each row.
Don’t expand it using the arrows; instead, click the gear icon next to the grouped step in applied steps.
In the dialog, select only the investortotaling column and remove the others.
The grouped column will now become a list.
Right-click the investortotaling column header and choose extract value.
Pick your preferred delimiter (such as | or ,) to combine all investor codes into a single text string for each account key.


Thank you,
Tejaswi

 

v-tejrama
Community Support
Community Support

Hi @brdrok ,

 

Thank you @mdaatifraza5556 and @FBergamaschi  for the response provided!  


Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone. 


Thank you for your understanding

Hi @brdrok ,

 

I wanted to follow up and see if you had a chance to review the information shared. If you have any further questions or need additional assistance, feel free to reach out.

Thank you.

Hi @brdrok ,

 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

Thank you,

Tejaswi.

brdrok
Helper I
Helper I

Hi @FBergamaschi ,

 

trying to attach an excel, csv, or pbix files but none will take.  Do you have any suggestions how to get the data to you?

Hi,

Upload the file to Google Drive/One Drive and share the download link here.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
mdaatifraza5556
Super User
Super User

Hi @brdrok 

As per my understanding of your requirement, I have tried with some demo data

Can you please try the below M code

Just copy the M-code and use from #"Split Column by Delimiter" becasuse you already have your table so from there u use the M- code

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUUqsSVKK1YlWcgKyk2tSwGyQeGpNGlw8vSYDzHYGsjNqMpViYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Key = _t, Investor = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Key", type text}, {"Investor", type text}}),
#"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"Investor", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Investor"),
GroupedRows = Table.Group(#"Split Column by Delimiter", {"Key"}, {
{"investors", each _, type table [Key=nullable text, Investor=nullable text]}
}),
AddedCustom = Table.AddColumn(GroupedRows, "Investor", each Text.Combine([investors][Investor], "|")),
FinalTable = Table.SelectColumns(AddedCustom, {"Key", "Investor"})
in
FinalTable


 

Data I used

Screenshot 2025-08-08 202121.png

 

 

Result

Screenshot 2025-08-08 203945.png

 


If this answers your questions, kindly accept it as a solution and give kudos.

FBergamaschi
Solution Sage
Solution Sage

Please include, in a usable format, not an image, a small set of rows for each of the tables involved in your request and show the data model in a picture, so that we can import the tables in Power BI and reproduce the data model. The subset of rows you provide, even is just a subset of the original tables, must cover your issue or question completely. Do not include sensitive information and do not include anything that is unrelated to the issue or question. Please show the expected outcome based on the sample data you provided and make sure, in case you show a Power BI visual, to clarify the columns used in the grouping sections of the visual.

 

Need help uploading data? click here

 

Want faster answers? click here

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.