Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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 

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

     

     

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

     

  • 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])
     

     

3 Replies

  • Applicable88's avatar
    Applicable88
    Icon for Impactful Individual rankImpactful Individual

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

     

     

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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks a lot!! works excelent!

  • 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])