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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Add the most recent exclusive records

I have a table with the key field (CHAVE), values and dates.
I would like an expression to add only the unique records based on the most recent date.

For example, for KEY XXX I would just like to add the value 10, for YYY just add 40....  and then put the sum of these unique records in a table by date.

 

luguilherme_0-1597260563118.png

 

 

and in the end I would like to be able to add a table as follows:

 

AAA   10

BBB    30

CCC   40

XXX   10

YYY  40

ZZZ   90

total  220

3 REPLIES 3
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Try this measure.

 

Last Value =  LASTNONBLANKVALUE('Table'[DATA],MAX('Table'[Peso]))

 

 

Regards,

Harsh Nathani

mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure expression, replacing Table with your actual table name.

 

 

Sum of Latest Values =
VAR summary =
    ADDCOLUMNS (
        VALUES ( Table[CHAVE] ),
        "@value", CALCULATE ( LASTNONBLANKVALUE ( Table[Date], MAX ( Table[Peso] ) ) )
    )
RETURN
    SUMX ( summary, [@value] )

 

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


lbendlin
Super User
Super User

Does it have to be in DAX, and can you provide the sample data in usable form?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.