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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
hobosapien
Helper I
Helper I

Keeping max values when grouping in Power Query

In the screenshot below I have multiples of the same Genre and the counts for each artist in that Genre. How do I only keep the max value count for each artist/genre combo?

 

hobosapien_0-1728002217127.png

 

 

 

3 ACCEPTED SOLUTIONS
PhilipTreacy
Super User
Super User

@hobosapien 

 

When you group by Genre and Artist name, select the Max aggregation in the Operation drop down

 

PhilipTreacy_0-1728003866627.png

 

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

Kedar_Pande
Super User
Super User

In Power BI, go to the "Transform Data" option to open Power Query Editor.

Go to the "Home" tab and click on "Group By".

In the Group By window:

  • In the Group By section, select "Genre" and "artist_name".
  • In the New column name section, name it something like Max Count.
  • In the Operation dropdown, select Max and choose the Count column.

View solution in original post

Anonymous
Not applicable

Hi @hobosapien ,

 

Thanks for @Kedar_Pande and @PhilipTreacy reply.

 

@hobosapien Here is another method for your reference if you want to add a column that calculates the maximum value of each category.

= Table.AddColumn(#"Last step", "MAX", (x)=>List.Max(Table.SelectRows(#"Last step", (y)=>y[Genre]=x[Genre] )[Count]) 
)

The result of my test.

vmengmlimsft_0-1728458568801.png

 

vmengmlimsft_1-1728458610833.png

 

 

 

 

Best regards,

Mengmeng Li

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @hobosapien ,

 

Thanks for @Kedar_Pande and @PhilipTreacy reply.

 

@hobosapien Here is another method for your reference if you want to add a column that calculates the maximum value of each category.

= Table.AddColumn(#"Last step", "MAX", (x)=>List.Max(Table.SelectRows(#"Last step", (y)=>y[Genre]=x[Genre] )[Count]) 
)

The result of my test.

vmengmlimsft_0-1728458568801.png

 

vmengmlimsft_1-1728458610833.png

 

 

 

 

Best regards,

Mengmeng Li

Kedar_Pande
Super User
Super User

In Power BI, go to the "Transform Data" option to open Power Query Editor.

Go to the "Home" tab and click on "Group By".

In the Group By window:

  • In the Group By section, select "Genre" and "artist_name".
  • In the New column name section, name it something like Max Count.
  • In the Operation dropdown, select Max and choose the Count column.
PhilipTreacy
Super User
Super User

@hobosapien 

 

When you group by Genre and Artist name, select the Max aggregation in the Operation drop down

 

PhilipTreacy_0-1728003866627.png

 

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.