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
Pbi07
Helper V
Helper V

Combine multiple rows and merge to 1 column

What is the best way out to merge multiple rows and combine the values into a single column.

 

Partner   Order    ID   Comments
1575       8001     1     Partner call
1575       8001     2    Order book
1575       8001     3    Order Ship
1580       8005     1    Quote request
1582       8020     1    Partner request
1582       8020     2    Order confirm


End result need to be as below. The ID column value range from 1 to N. 

 

Partner   Order    Comments
1575       8001     Partner call;Order book;Order Ship
1580       8005     Quote request
1582       8020     Partner request; Order confirm

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi @Pbi07 

For your case, you could try these two way:

1. use dax to create a new table as below:

Table (By dax) =
SUMMARIZE (
    'Table',
    'Table'[Partner],
    'Table'[Order],
    "Comments", CONCATENATEX ( VALUES ( 'Table'[Comments] ), [Comments], ";" )
)

Result:

4.JPG

2. in edit queries, group by the table as below:

= Table.Group(#"Changed Type", {"Partner", "Order"},  {"Comments", each Text.Combine([Comments], ";"), type text})

Result:

5.JPG

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi @Pbi07 

For your case, you could try these two way:

1. use dax to create a new table as below:

Table (By dax) =
SUMMARIZE (
    'Table',
    'Table'[Partner],
    'Table'[Order],
    "Comments", CONCATENATEX ( VALUES ( 'Table'[Comments] ), [Comments], ";" )
)

Result:

4.JPG

2. in edit queries, group by the table as below:

= Table.Group(#"Changed Type", {"Partner", "Order"},  {"Comments", each Text.Combine([Comments], ";"), type text})

Result:

5.JPG

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Lin

 

I found this post very helpful, in my situation I am trying to convert my table view from lookig like this  -  

 

CostCenterProject Leader1CC_prefixBudgetNameProject_IDCostCenter2
456ABCChris Harp456Thomas Bell78787899777ABC
456XYZChris Harp466Peter Welling78787899777ABC

 

to look something like this - 

CostCenter_combinedProject Leader1CC_prefixBudgetName_combinedProject_IDCostCenter2
456ABC | 466XYZChris Harp456Thomas Bell | Peter Welling78787899777ABC

 

So the Project_ID is unique, the reason for the top version is because there are two members working on the same project but I want to show in my report one project_id at 'X' value.  As it stands the a top table produces the total project value x 2 when it only should be one value.  So if the value was 1000.00 GBP, the the table at the top would show 1000.00 GBP twice, when it needs to be only once.  

 

Chris

Thank you. Perfect solution.

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.