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
Anonymous
Not applicable

Sum/summarize by 2 variables

Hi Team,

 

Appreciate you giving your expertise in the below, I have been trying for a while now 😞

 

I have opportunites, their value, and type. I want to sum by type for each unique opportunity ID.

 

For Ex: HW= 200 for opp A + 100 for opp C + 400 for opp D = 700

 

I use this 

Total Value= sumx(summarize(masterdata, masterdata[Opportunity ID], masterdata[Value] ), [Value])
 
But it doesnt give right graphs per type.
 
 
Opportunity IDValueType
A200HW
A200HW
A200HW
A200HW
B500SW
B500SW
C100HW
C100HW
D400HW
TTT700SW
DD300SW
DD300SW

 

Thanks,

Amr

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try:

Total Value = 
var _t=SUMMARIZE('masterdata',[Opportunity ID],[Value],[Type])
return SUMX(FILTER(_t,[Type]=MAX([Type])),[Value])

Eyelyn9_1-1637564689570.png

 

Best Regards,
Eyelyn Qin
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

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Please try:

Total Value = 
var _t=SUMMARIZE('masterdata',[Opportunity ID],[Value],[Type])
return SUMX(FILTER(_t,[Type]=MAX([Type])),[Value])

Eyelyn9_1-1637564689570.png

 

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

Greg_Deckler
Community Champion
Community Champion

@Anonymous Try:

Total Value= maxx(summarize(masterdata, masterdata[Type], "__Value", SUM(masterdata[Value]) ), [__Value])

That said, this is all about context. If you just place Type in a visual and use a simple SUM('masterdata'[Value]) then your numbers should come out correct according to Type.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors