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
Anonymous
Not applicable

Expand Multiple Values as One Row

I have a set of data that has multiple values in one field (see below). When I expand that data it creates multiple rows and duplicates the rest of the data. However, this is causing me issues for both displaying the data and creating relationships. How can I show these in one row?

 

*Because project number is my unique identifier, I only want this project number listed once so I do not end up creating many to many relationships.

 

Current State:

 

Project NumberProject TitleSponsorLocation
1Project 1Executive AIndiana
2

Project 2

Executive BNew York
3Project 3Executive AVirginia
3Project 3Executive AIndiana
4Project 4Executive BNew York

 

 

Desired Output:

Project NumberProject TitleSponsorLocation
1Project 1Executive AIndiana
2

Project 2

Executive BNew York
3Project 3Executive AVirginia, Indiana
4Project 4Executive BNew York
1 ACCEPTED SOLUTION

Yes you can extract a column from the table here is the syntax:

 

#"Extract_List" = Table.TransformColumns(#"Removed Columns, {"ProjectLead", each Text.Combine(List.Transform(Table.TransformRows(_,each [Name]), Text.From), ","), type text})

 

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

 

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

This M code works

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"Project Number"}, {{"All Locatinos", each Text.Combine(List.Distinct([Location]), ", "), type text}}),
    Joined = Table.Join(Source, "Project Number", #"Grouped Rows", "Project Number"),
    #"Removed Columns" = Table.RemoveColumns(Joined,{"Location"}),
    #"Removed Duplicates" = Table.Distinct(#"Removed Columns")
in
    #"Removed Duplicates"

Hope this helps.

Untitled.png


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

Instead of "Expand to New Rows" you can Extract Values in comma-delimited format.

 

1.png

 

Alternatively, you can write m query to extract list as comma-delimited value in new column:

 

    Extract_List = Table.TransformColumns(PrevStep, {"Listxyz", each Text.Combine(List.Transform(_, Text.From), ","), type text}),

 

Hi, I have got a similar situation. My share point is giving person field with multiple people. In powerbi, it is coming as a table. Once I extract values from the table, I have multiple rows 

 

ID 1     Name 1    Red    Sunday

ID 1     Name 2    Red    Sunday.

 

I want in my matrix to come as only 1 row

 

TIA

Anonymous
Not applicable

Does the m query work if it is a "table" I am expanding rather than a list?

 

enswitzer_0-1600180105244.png

 

I am getting an error with this:

#"Extract_List" = Table.TransformColumns(#"Removed Columns", {"ProjectLead", each Text.Combine(List.Transform(_, Text.From), ","), type text}),

 

Anonymous
Not applicable

I should clarify - it's the "Name" field, I'm trying to get out of this:

 

enswitzer_0-1600180445936.png

 

Yes you can extract a column from the table here is the syntax:

 

#"Extract_List" = Table.TransformColumns(#"Removed Columns, {"ProjectLead", each Text.Combine(List.Transform(Table.TransformRows(_,each [Name]), Text.From), ","), type text})

 

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

 

Hi, I have got a similar situation. My share point is giving person field with multiple people. In powerbi, it is coming as a table. Once I extract values from the table, I have multiple rows 

 

ID 1     Name 1    Red    Sunday

ID 1     Name 2    Red    Sunday.

 

I want in my matrix to come as only 1 row

 

TIA

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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 Solution Authors