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
topazz11
Helper III
Helper III

Maximum value and total by group

@Ashish_Mathur  helped me this yesterday. it works great but I want to sum the max_amt column by group.

Currently it picks up larger value between amt1 and amt2.

as an example below, it should be 1600, not 1550.

PBI file is here.  PBIX file

 
 Product IDLine NoAmt1 Amt2Max_Amt
 PP89    1   250     100    250
       2   500     550    550
      3   800     500    800
    Total 1,550    1,150  1,600

Thank you,

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @topazz11 ,

 

You can create measure like DAX below.

 

Max_Amt = 
VAR Amount1 = if(HASONEVALUE(Append1[Attribute]),[Total],MAXX(VALUES(Append1[Attribute]),[Total])) VAR _table = SUMMARIZE(Append1, Append1[Area],Append1[Prod ID],Append1[Line No],"_Value",[Amount1]) RETURN IF(HASONEVALUE(Append1[Line No]),[Amount1],SUMX(_table,[_Value]))

Best Regards,

Amy

 

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

1 REPLY 1
v-xicai
Community Support
Community Support

Hi @topazz11 ,

 

You can create measure like DAX below.

 

Max_Amt = 
VAR Amount1 = if(HASONEVALUE(Append1[Attribute]),[Total],MAXX(VALUES(Append1[Attribute]),[Total])) VAR _table = SUMMARIZE(Append1, Append1[Area],Append1[Prod ID],Append1[Line No],"_Value",[Amount1]) RETURN IF(HASONEVALUE(Append1[Line No]),[Amount1],SUMX(_table,[_Value]))

Best Regards,

Amy

 

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

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.