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

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

Reply
Syndicate_Admin
Administrator
Administrator

Sum the values of only the maximum value based on a category

Hi, I'm at the Powerbi desktop, working with a dataset where I need to sum up the SKU values by selecting the maximum in a few categories: export and account.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks @Ashish_Mathur 

Hi, @Syndicate_Admin 

Based on your description, I've created the following sample data:

vjianpengmsft_0-1716170670821.png

I've tried summing the category of the maximum value using the following metric expression:

MaxValue = 
VAR _maxvalue = CALCULATE(MAX('Table'[Value]),ALLEXCEPT('Table','Table'[Category],'Table'[SubCategory]))
RETURN SUMX(FILTER('Table','Table'[Value]=_maxvalue),'Table'[Value])

Here are the results:

vjianpengmsft_1-1716170861419.png

If you don't understand something, it would be helpful if you could provide some virtual sample data and describe the output you are looking for.

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

2 REPLIES 2
Anonymous
Not applicable

Thanks @Ashish_Mathur 

Hi, @Syndicate_Admin 

Based on your description, I've created the following sample data:

vjianpengmsft_0-1716170670821.png

I've tried summing the category of the maximum value using the following metric expression:

MaxValue = 
VAR _maxvalue = CALCULATE(MAX('Table'[Value]),ALLEXCEPT('Table','Table'[Category],'Table'[SubCategory]))
RETURN SUMX(FILTER('Table','Table'[Value]=_maxvalue),'Table'[Value])

Here are the results:

vjianpengmsft_1-1716170861419.png

If you don't understand something, it would be helpful if you could provide some virtual sample data and describe the output you are looking for.

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

 

 

Ashish_Mathur
Super User
Super User

Hi,

Share some data, explain the question and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors