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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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