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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
mterry
Helper V
Helper V

Assistance with grouping/summarizing rows based on logic

I'm working with a table that has the Name, ID and location of different entities that I need to consolidate. In many instances the entity is repeated multiple times based on different locations. Locations are scored, but there can be multiple locations for a single entity that have the same score. I would like to summarize this data based on the unique ID so each only appers one time, and in the instance where there are locations with different scores it uses the highest score, but if there are ties for the highest score then it doesn't matter which row it uses, but it does need to consolidate to a single row. I can't share the actual data, but I created a dummy version of the before and after that I'm looking for. This table is a sample of what the data looks like: 

NameIDStreet AddressCityPostal CodeStateCountryScore
Acme11234 AnywhereDenver80222COUnited States15
Acme1456 MainParker80134COUnited States15
Sample12PO Box 1235Dallas TXUnited States14
Sample12 Los Angeles  United States12
Contoso5 El Paso TXUnited States7

 

And below is what I'd like the final output to look like. For ACME I don't care if it selects the Parker or Denver row since the scores were the same, I just need to ensure it consolidates to a single row/entry. For Sample the PO Box row will be used because it was scored higher than the row with Los Angeles as the city, and Contoso has a single entry so that will remain as-is. 

 

NameIDStreet AddressCityPostal CodeStateCountryScore
Acme1456 MainParker80134COUnited States15
Sample12PO Box 1235Dallas TXUnited States14
Contoso5 El Paso TXUnited States7
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@mterry , based on what I got. You can create a Rank (new function) or row number using the partition of name and order by unique rank. or add an index column in the power query and then use a visual level filter for rank =1

 

Power BI - New DAX Function: RANK - How It Differs from RANKX: https://youtu.be/TjGkF44VtDo

Power BI - New DAX Function: Rownumber- https://www.youtube.com/watch?v=yS9-IQjUDwg&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L&index=1

 

Power Query- Index Column: https://youtu.be/NS4esnCDqVw

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@mterry , based on what I got. You can create a Rank (new function) or row number using the partition of name and order by unique rank. or add an index column in the power query and then use a visual level filter for rank =1

 

Power BI - New DAX Function: RANK - How It Differs from RANKX: https://youtu.be/TjGkF44VtDo

Power BI - New DAX Function: Rownumber- https://www.youtube.com/watch?v=yS9-IQjUDwg&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L&index=1

 

Power Query- Index Column: https://youtu.be/NS4esnCDqVw

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.