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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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

7 REPLIES 7
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.