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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
pettat
Regular Visitor

Merge / Concatenate Note Fields

2022-08-16 09_05_11-Window.jpg

 

Hi Everyone 

I'm not sure this is possible, but is there a way to merge or concatenate two Note fields

 

In the attachment, the ParentID is the main order number and the Note field has a maximum length and anything longer than that continues onto the next SeqNum and Note field

 

This particular example only has SeqNum 1 and 2, but there are others in the database that go much larger (I've seen SeqNum fields as large as 6 for the same ParentID)

 

I hope that I've explained this well - and thanks in advance for any help you can offer 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@pettat 

If you want to do it in PQ then follow these steps, I made a sampe data set

Fowmy_0-1660659411614.png

Added a grouping to combine the notes, the results

Fowmy_1-1660659461793.png


Create a blank Query, go to the Advanced Editor, clear the existing code, and paste the codes give below and follow the steps.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTI0ABFA7JdfkqpgqJCSWpKYmVOsFKsTrWQEkzeCyRuhyIP1GxHQb4RbvzGGfmNM802AhBkW82MB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [NoteID = _t, #"Parent ID" = _t, #"Other Field" = _t, Note = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"NoteID", Int64.Type}, {"Parent ID", Int64.Type}, {"Other Field", Int64.Type}, {"Note", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Parent ID"}, {{"Count", each Text.Combine([Note],", "), type nullable text}})
in
    #"Grouped Rows"



 




 





Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

3 REPLIES 3
Fowmy
Super User
Super User

@pettat 

If you want to do it in PQ then follow these steps, I made a sampe data set

Fowmy_0-1660659411614.png

Added a grouping to combine the notes, the results

Fowmy_1-1660659461793.png


Create a blank Query, go to the Advanced Editor, clear the existing code, and paste the codes give below and follow the steps.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTI0ABFA7JdfkqpgqJCSWpKYmVOsFKsTrWQEkzeCyRuhyIP1GxHQb4RbvzGGfmNM802AhBkW82MB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [NoteID = _t, #"Parent ID" = _t, #"Other Field" = _t, Note = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"NoteID", Int64.Type}, {"Parent ID", Int64.Type}, {"Other Field", Int64.Type}, {"Note", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Parent ID"}, {{"Count", each Text.Combine([Note],", "), type nullable text}})
in
    #"Grouped Rows"



 




 





Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Sorry for the delayed reply - thank you very much!!  It worked nicely.

tamerj1
Super User
Super User

Hi @pettat 
It would be much better if you provide a couple of examples. Thank you

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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