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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
YC
Frequent Visitor

Help on MAX formula

Hello! I am trying to create a measure or a column to calculate the max value by material and by region, as per below example. 

Basically, if I will not filter anything on region, I want to see Max by material only, if I filter region I want to see max by material & region.

 

RegionMaterialPriceMax price (per material/per region)Max price (per material)
Europematerial A335
NAmaterial A555
LAmaterial A225
Europematerial A135
Europematerial B94598
Europematerial B454598
Asiamaterial B2298
NAmaterial B989898
NAmaterial B139898

 

I managed to calculate it separately (by material, and separate by region), using this formula:

CALCULATE(MAX('Dataset'[Price]), FILTER(ALLSELECTED('Dataset'),'Dataset'[Material]=EARLIER('Dataset'[Material])))
 
But I need to have it done based on both criteria so that I can show the correct value when filtering a certain region. 
 
Can someone please guide me on what is the correct formula to obtain this?
 
Thank you!
1 ACCEPTED SOLUTION

I have updated the formula in the same comment. Please double check and let me know what results you get?

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @YC 
Please try 

 

 

Max price (per material) =
CALCULATE (
    MAX ( 'Dataset'[Price] ),
    ALLEXCEPT ( 'Dataset', 'Dataset'[Material], 'Dataset'[Rgion] )
)

 

 

YC
Frequent Visitor

Hello! Thank you very much for the formula. This is working to show max per material indeed, but if I would filter a certain region, will not give the correct result.

YC_0-1652770740763.png

 

I have updated the formula in the same comment. Please double check and let me know what results you get?

YC
Frequent Visitor

With second field changed to region worked perfectly fine. Thank you very much for the help!!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.