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

Merge rows where ID is the same

Hi all,

 

I have this table:

 

Capture.JPG

 


As you can see we have a duplicate in "CompanyID3". What I would like to achieve is to merge the 2 rows where "CompanyID3" = 13087, where the one with an ID in "CompanyID1" is the winner. Meaning - is there a duplicate in ID3, then the one with value in ID1 (if any) wins.

Is it possible?

 

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

Hi,

 

Please try to create this calculated column:

Column = 
var id3 = 'Table'[Companies.CompanyID3]
var check = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Companies.CompanyID3]=id3))
return
IF(check=2&&'Table'[Companies.CompanyID1]=BLANK(),0,1)

Then apply it to the original table visual, the result shows:

20.PNG

Hope this can help.

 

Best Regards,

Giotto Zhi

 

View solution in original post

2 REPLIES 2
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please try to create this calculated column:

Column = 
var id3 = 'Table'[Companies.CompanyID3]
var check = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Companies.CompanyID3]=id3))
return
IF(check=2&&'Table'[Companies.CompanyID1]=BLANK(),0,1)

Then apply it to the original table visual, the result shows:

20.PNG

Hope this can help.

 

Best Regards,

Giotto Zhi

 

MFelix
Super User
Super User

Hi @PeterStuhr ,

 

Check the post below believe that you can make some similar option for your data.

 

https://community.powerbi.com/t5/Desktop/Remove-duplicate-rows-based-on-max-value-of-a-different-col...

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



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.