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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Help with dax measure

Hi, I really apreciate if any one can help me with this problem

 

ID SchoolLevelServiceQty
101primary schoolLunch20
101primary schoolBreakfast18
101primary schoolsnacks7
101high schoolLunch30
101high schoolBreakfast40
602primary schoolLunch10
602primary schoolBreakfast21
602high schoolLunch25
602high schoolBreakfast15


Max qty by service in
ID 101
for primary school is 20,
For high shcool is 40 
in ID 602 
for primary school is 21,
For high shcool is 25

 

Expected measure result is 20+40+21+25 =106 

2 ACCEPTED SOLUTIONS
Applicable88
Impactful Individual
Impactful Individual

@Anonymous , as I understood the ID school and schoollevel belonging together, so you can summarize them. Please take a look at Measure:

 

Applicable88_0-1633536350999.png

 

Measure = sumx( ADDCOLUMNS(SUMMARIZE(Tabelle1,Tabelle1[ID School],Tabelle1[Level]),"Total", calculate(MAX(Tabelle1[Qty]))),[Total])
 
Hope it helps.
Best regard. 

 

View solution in original post

Natallia_23
Resolver I
Resolver I

Hello,

 

Max = CALCULATE(MAX(Table1[Qty]),ALLEXCEPT(Table1,Table1[ID],Table1[School Level]))
 
Result =
var x = SUMMARIZECOLUMNS(Table1[ID],Table1[School Level], "res", [Max] )
return sumx(x, [res])
 
Natallia_23_0-1633537400084.png

 

View solution in original post

3 REPLIES 3
Natallia_23
Resolver I
Resolver I

Hello,

 

Max = CALCULATE(MAX(Table1[Qty]),ALLEXCEPT(Table1,Table1[ID],Table1[School Level]))
 
Result =
var x = SUMMARIZECOLUMNS(Table1[ID],Table1[School Level], "res", [Max] )
return sumx(x, [res])
 
Natallia_23_0-1633537400084.png

 

Applicable88
Impactful Individual
Impactful Individual

@Anonymous , as I understood the ID school and schoollevel belonging together, so you can summarize them. Please take a look at Measure:

 

Applicable88_0-1633536350999.png

 

Measure = sumx( ADDCOLUMNS(SUMMARIZE(Tabelle1,Tabelle1[ID School],Tabelle1[Level]),"Total", calculate(MAX(Tabelle1[Qty]))),[Total])
 
Hope it helps.
Best regard. 

 

Anonymous
Not applicable

Thanks a lot!! works excelent!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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