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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
webportal
Impactful Individual
Impactful Individual

Merge column in Power Query

My table has around 500K rows with the following structure:

 

webportal_0-1634298373599.png

 

I want to merge the Address column.

 

Can anyone help?

 

Thanks!

2 ACCEPTED SOLUTIONS
DataInsights
Super User
Super User

@webportal,

 

Try this in Power Query. The Source step will be your data source. I used a comma delimiter in the GroupAddress step; you can use any delimiter.

 

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "i45WMlTSUXJ0cgaShgYGSrE60UpApourG5CE8dw9PGE8IyDDy9sHpNoUrtrXzx9JdUBgEIxnDGQEh4QCSUtLS5h8WEQkkuqoqCgwLxYA",
          BinaryEncoding.Base64
        ),
        Compression.Deflate
      )
    ),
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [Id = _t, Address = _t, Sales = _t]
  ),
  ChangeType = Table.TransformColumnTypes(
    Source,
    {{"Id", Int64.Type}, {"Address", type text}, {"Sales", Int64.Type}}
  ),
  FillDownId = Table.FillDown(ChangeType, {"Id"}),
  GroupAddress = Table.Group(
    FillDownId,
    {"Id"},
    {{"Combined Address", each Text.Combine([Address], ", "), type text}}
  ),
  TableAmount = Table.SelectRows(
    Table.SelectColumns(ChangeType, {"Id", "Sales"}),
    each ([Id] <> null)
  ),
  TableJoin = Table.NestedJoin(
    TableAmount,
    {"Id"},
    GroupAddress,
    {"Id"},
    "TableAddress",
    JoinKind.Inner
  ),
  ExpandTable = Table.ExpandTableColumn(
    TableJoin,
    "TableAddress",
    {"Combined Address"},
    {"Combined Address"}
  )
in
  ExpandTable

 

DataInsights_0-1634311335710.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

smpa01
Community Champion
Community Champion

@DataInsights  not trying to step on your toes, but in this solution the Join can be avoided altogther and this can optimize performnace dramatically on a large tbl

 

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "i45WMlTSUXJ0cgaShgYGSrE60UpApourG5CE8dw9PGE8IyDDy9sHpNoUrtrXzx9JdUBgEIxnDGQEh4QCSUtLS5h8WEQkkuqoqCgwLxYA",
          BinaryEncoding.Base64
        ),
        Compression.Deflate
      )
    ),
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [Id = _t, Address = _t, Sales = _t]
  ),
  ChangeType = Table.TransformColumnTypes(
    Source,
    {{"Id", Int64.Type}, {"Address", type text}, {"Sales", Int64.Type}}
  ),
  FillDownId = Table.FillDown(ChangeType, {"Id"}),
  GroupAddress = Table.Group(
    FillDownId,
    {"Id"},
    {{"Combined Address", each Text.Combine([Address], ", "), type text},{"max", each List.Max([Sales]), type nullable number}}
  )
in
    GroupAddress

 


========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================

View solution in original post

4 REPLIES 4
webportal
Impactful Individual
Impactful Individual

@smpa01 

@DataInsights 

Thank you, both solutions work!

smpa01
Community Champion
Community Champion

@DataInsights  not trying to step on your toes, but in this solution the Join can be avoided altogther and this can optimize performnace dramatically on a large tbl

 

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "i45WMlTSUXJ0cgaShgYGSrE60UpApourG5CE8dw9PGE8IyDDy9sHpNoUrtrXzx9JdUBgEIxnDGQEh4QCSUtLS5h8WEQkkuqoqCgwLxYA",
          BinaryEncoding.Base64
        ),
        Compression.Deflate
      )
    ),
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [Id = _t, Address = _t, Sales = _t]
  ),
  ChangeType = Table.TransformColumnTypes(
    Source,
    {{"Id", Int64.Type}, {"Address", type text}, {"Sales", Int64.Type}}
  ),
  FillDownId = Table.FillDown(ChangeType, {"Id"}),
  GroupAddress = Table.Group(
    FillDownId,
    {"Id"},
    {{"Combined Address", each Text.Combine([Address], ", "), type text},{"max", each List.Max([Sales]), type nullable number}}
  )
in
    GroupAddress

 


========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================

@smpa01,

 

I like your solution. Thanks for sharing! 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




DataInsights
Super User
Super User

@webportal,

 

Try this in Power Query. The Source step will be your data source. I used a comma delimiter in the GroupAddress step; you can use any delimiter.

 

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "i45WMlTSUXJ0cgaShgYGSrE60UpApourG5CE8dw9PGE8IyDDy9sHpNoUrtrXzx9JdUBgEIxnDGQEh4QCSUtLS5h8WEQkkuqoqCgwLxYA",
          BinaryEncoding.Base64
        ),
        Compression.Deflate
      )
    ),
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [Id = _t, Address = _t, Sales = _t]
  ),
  ChangeType = Table.TransformColumnTypes(
    Source,
    {{"Id", Int64.Type}, {"Address", type text}, {"Sales", Int64.Type}}
  ),
  FillDownId = Table.FillDown(ChangeType, {"Id"}),
  GroupAddress = Table.Group(
    FillDownId,
    {"Id"},
    {{"Combined Address", each Text.Combine([Address], ", "), type text}}
  ),
  TableAmount = Table.SelectRows(
    Table.SelectColumns(ChangeType, {"Id", "Sales"}),
    each ([Id] <> null)
  ),
  TableJoin = Table.NestedJoin(
    TableAmount,
    {"Id"},
    GroupAddress,
    {"Id"},
    "TableAddress",
    JoinKind.Inner
  ),
  ExpandTable = Table.ExpandTableColumn(
    TableJoin,
    "TableAddress",
    {"Combined Address"},
    {"Combined Address"}
  )
in
  ExpandTable

 

DataInsights_0-1634311335710.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.