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

DAX Formula - Return a calculated column MAX after grouping multiple other columns

I know this should be easy but despite trying and trying different options and searching for a couple hours, I can't get this to work.

 

As an example, I have scores in a table like this...

 

PlayerDateCourtGameScore
Andy12/20/20171115
Bert12/20/20171110
Jeff12/20/20171110
Ryan12/20/20171115
Hank12/20/2017214
Pete12/20/20172118
Mike12/20/20172118
Kevin12/20/2017214

 

I'd like to return a new calculated column value of the MAX score for a combination of 3 grouped values, the date, the court, and the game. So essentially 15 for the first 4 rows and 18 for the second 4 rows and so on.

 

The closest attempts I've found are

=CALCULATE(MAX('Scores'[Score]), GROUPBY(Scores,[Date],[Court],[Game]))

but that seems to simply return the Score value for the current row.

 

=MAXX(SUMMARIZE(Scores,[Date],[Court],[Game],"Max Score of Specific Game",MAX([Score])),[Max Score of Specific Game])

seems to always return the max regardless of how many different games are showing.

 

I've looked and looked for solutions to this and I just can't figure out what I'm doing wrong. I'm new to DAX and while this would be easy for me as a SQL query, I'm struggling with the DAX representation of it. I'm sure it's likely a simple solution and any help you can provide will be appreciated.

 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @pelowski

 

Try this Column

 

MyMax =
CALCULATE (
    MAX ( Scores[Score] ),
    ALLEXCEPT ( Scores, Scores[Date], Scores[Court], Scores[Game] )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

Hi @pelowski

 

Try this Column

 

MyMax =
CALCULATE (
    MAX ( Scores[Score] ),
    ALLEXCEPT ( Scores, Scores[Date], Scores[Court], Scores[Game] )
)

Regards
Zubair

Please try my custom visuals

I'm also looking to do the same and this solution almost gets me there.  Is it possible to only show the max value in the row that has the value and leave the remaining blank?  For Example in the section in the blue box, Is it possible to show the highest score of 18 only in the row that has the score of 18 and leave the other rows blank?

Yes!  That did it!  Thank you!

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.