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

Sum of MAX Results

What formula can I use to get the sum of all MAX items?
The sum of these MAX by Line items is 3.13...how do I get that with a formula?  I used this formula to get the MAX figures by line:

MaxEarnedHours = max('ATWOQ300 - Current'[Earned Hours Sum])

Line      MaxEarnedHours

323          .21

322          1.60

380          .50

310          .46

382          .36

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Does this measure work?

=SUMX(VALUES('ATWOQ300 - Current'[Line]),[MaxEarnedHours])

If it does not, then share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

9 REPLIES 9
Greg_Deckler
Super User
Super User

@Anonymous This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Ashish_Mathur
Super User
Super User

Hi,

Does this measure work?

=SUMX(VALUES('ATWOQ300 - Current'[Line]),[MaxEarnedHours])

If it does not, then share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
pranit828
Community Champion
Community Champion

Hi @Anonymous 

 

_SumOfMax = SUMX(
SUMMARIZE('ATWOQ300 - Current', 'ATWOQ300 - Current'[Line], "MaxOfSum", max('ATWOQ300 - Current'[Earned Hours Sum]),

[MaxOfSum])





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
pranit828
Community Champion
Community Champion

HI @Anonymous 

try

MaxEarnedHours = calculate(sumx('ATWOQ300 - Current',[MaxEarnedHours]), ALLEXCEPT('ATWOQ300 - Current','ATWOQ300 - Current'[Line]))





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
Anonymous
Not applicable

Thx.  This retuned a result of 1196 vs the 3.13.

amitchandak
Super User
Super User

@Anonymous , Not very clear. The context till where we need to take max. It that line the formula will be like

 

MaxEarnedHours = sumx(values('ATWOQ300 - Current'[line]),max('ATWOQ300 - Current'[Earned Hours Sum]))

or

MaxEarnedHours = sumx(summarize('ATWOQ300 - Current'[line],"_1",max('ATWOQ300 - Current'[Earned Hours Sum])),[_1])

Anonymous
Not applicable

This formula worked perfect...THX!
=SUMX(VALUES('ATWOQ300 - Current'[Line]),[MaxEarnedHours])
I tried to select that this solved the issue in the thread and it errored out twice.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thx for the quick response.  I used the formula: MaxEarnedHours = sumx(values('ATWOQ300 - Current'[line]),max('ATWOQ300 - Current'[Earned Hours Sum])) and it returned a value of 8 instead of 3.13.  Thoughts?

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.