Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
rbustamante
Helper I
Helper I

How to obtain the max record for each one of the records

Hello,

I have the following table and I need DAX sentence to obtain the right table, that are the maximun values record of the left table.

rbustamante_0-1613946601024.png

Thanks in advance.

 

4 REPLIES 4
Nathaniel_C
Community Champion
Community Champion

Max.PNG

Hi @rbustamante , 

Try this:

 

Max value = 
var _curId = MAX(SourceTable[ID]) //Get Current ID
var _curValue = MAX(SourceTable[Value]) //Get current value


var _calc = CALCULATE(MAX(SourceTable[Value]),FILTER(ALLEXCEPT(SourceTable,SourceTable[ID]), MAX(SourceTable[ID])=_curId))

Return 

IF(_curValue =  _calc,_calc)

 

If you leave off the value column, and just use the measure, you will get this.

 

max1.PNG


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for the response.

What do you mean whe you said "If you leave off the value column, and just use the measure, you will get this."?

Hi @rbustamante ,
I created the table visual from the source table with 4 columns; Group, ID, Value, Max Value.  The Max Value is the measure that I created.  This shows all the values, and blanks in the measure column.

 

If you create the table with only Group, ID, and my measure Max Value you will see that the the reduced table with no blanks that more closely matches your table to the right of Desired Result.  It just depends on what you want to show.  A measure has a much smaller footprint than a calculated column.  It just depends on what you are using these values to do.

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




lbendlin
Super User
Super User

Please  provide more information. Should this be a calculated column or a measure?

Here is how a calculated column would look like:

Include = 
var m = CALCULATE(max('Table'[Value]),ALLEXCEPT('Table','Table'[Id]))
return if('Table'[Value]=m,1,0)

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.