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

Combine rows on unique ID

Hello, I have the below table called remcost which has a uniqueID called ddID.

 

Capture.JPG

 

What I need is based upon the column ddID combine the fields that that have in the column rc-type "labour" into 1 field so it lists each person by the column rc-number (Michael Hegerty, Paul Riley, Stephen Spencer, Matthew Spice) and keeps another column for rc-type "vehicle" which is also in rc-number (EK55 TKJ).

 

I'm adding these to a table view and want 2 seperate columns for the combined labour and then 1 for the vehicle. and this is all showing by ddID

 

any help would be appreciated

 

thanks 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous

 

Try the below 2 measures.

MLabour = CONCATENATEX(Table1,IF(Table1[rc-type]="Labour",Table1[rc-number]),",")

MLabour = CONCATENATEX(Table1,IF(Table1[rc-type]="Vehicle",Table1[rc-number]),",")

 

Its close to your expectation, but leading/ trailing "," are displayed , a little tune will do from here.

 

Thanks
Raj

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Can you please post the expected output in table format for the given sample data?

 

Also, please post the sample data in copy- pasteable format so that we dont have to type the data again.

 

Thanks
Raj

Anonymous
Not applicable

Hi Raj, here is what I expect the output to be (I have a few other columns in the output from other tables that hopefully shouldn't cause a problem)

 

ddIDLabourVehicle
41461Michael Hegerty, Paul Riley, Stephen Spencer, Matthew SpiceEK55 TKJ

 

and here is the specific columns from the table 

 

ddIDrc-numberrc-type
41461EK55 TKJVehicle
41461Matthew SpiceLabour
41461Stephen SpencerLabour
41461Paul RileyLabour
41461Michael HagertyLabour

 

If this is not what you require please advise. My knowledge of Power BI is not brilliant. Sorry

 

thanks 

Anonymous
Not applicable

Hi @Anonymous

 

Try the below 2 measures.

MLabour = CONCATENATEX(Table1,IF(Table1[rc-type]="Labour",Table1[rc-number]),",")

MLabour = CONCATENATEX(Table1,IF(Table1[rc-type]="Vehicle",Table1[rc-number]),",")

 

Its close to your expectation, but leading/ trailing "," are displayed , a little tune will do from here.

 

Thanks
Raj

 

Anonymous
Not applicable

Thank you Raj that is perfect

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.