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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Mirithu
Helper II
Helper II

Get Most Recent Date and Amount

Hello,

I am trying to write a DAX measure that will give me the most recent date and the corresponding values for that date from a data set below:

DateNameAmount
06/09/2021An Other5899
09/11/2021An Other178
15/01/2021Jane Doe800
30/07/2021Jane Doe6400
22/02/2021John Smith66
23/05/2021John Smith2000

 

I have the following measure:

 

Max Date =
MAXX(
FILTER( ALL('Data' ), 'Data'[Name] = SELECTEDVALUE('Data'[Name] )),
'Data'[Date]
)
 
When I add it to the table, I get the most recent date, but the amount is added up.
 
Max DateNameAmount
09/11/2021An Other6077
30/07/2021Jane Doe7200
23/05/2021John Smith2066

 

How do I write the measure to get the distinct values for the most recent dates i.e.

 

Max DateNameAmount
09/11/2021An Other178
30/07/2021Jane Doe6400
23/05/2021John Smith2000

 

Thank you.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Mirithu , try a measure like

 

count Measure =
VAR __id = MAX ('Table'[Name] )
VAR __date = CALCULATE ( MAX('Table'[DAte] ), ALLSELECTED ('Table' ), 'Table'[Name] = __id )
CALCULATE ( sum ('Table'[Amount] ), VALUES ('Table'[Name] ),'Table'[Name] = __id,'Table'[DAte] = __date )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Mirithu
Helper II
Helper II

Works perfectly! Thank you.

amitchandak
Super User
Super User

@Mirithu , try a measure like

 

count Measure =
VAR __id = MAX ('Table'[Name] )
VAR __date = CALCULATE ( MAX('Table'[DAte] ), ALLSELECTED ('Table' ), 'Table'[Name] = __id )
CALCULATE ( sum ('Table'[Amount] ), VALUES ('Table'[Name] ),'Table'[Name] = __id,'Table'[DAte] = __date )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors