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
alexei7
Continued Contributor
Continued Contributor

Measure to select most recent value of a dimension, based on the date filtered

I'm struggling to come up with the DAX to product a measure which will give me the "most recent" status for a product.
The report contains a date slicer, so the "most recent date" for the status would be dependent on the date range the user had filtered on. 

 

My source data is one large table containing the following fields:

ProductID
ProductName
Location
Date
Status
ProductCategory
ProductAbbreviation
Many other dimensions which should be ignored for this report...

 

My desired output is a table with the following:

ProductID
ProductName
Location
Most recent status - new measure

 

Notes

- Data is added/updated monthly
- Products can be at more than one location
- Users will be able to filter on the date

 

 

The pbix model with some fake data in it is here:

https://mega.nz/file/ao1n3STS#uDqZD0TH-cG5-8_YlWu5PZSS0k6PVaaikXUtb4KSJxg

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@alexei7 , Add this

lastnonblankvalue(Table[Date], max(Table[Status]))

 

or


calculate(max(Table[Status]), filter(Table, Table[Date] = calculate(max(Table[Date]), allexcept(Table, Table[Product ID]))))

or

calculate(max(Table[Status]), filter(Table, Table[Date] = calculate(max(Table[Date]), allexcept(Table, Table[Product ID], Table[Location]))))

 

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
amitchandak
Super User
Super User

@alexei7 , Add this

lastnonblankvalue(Table[Date], max(Table[Status]))

 

or


calculate(max(Table[Status]), filter(Table, Table[Date] = calculate(max(Table[Date]), allexcept(Table, Table[Product ID]))))

or

calculate(max(Table[Status]), filter(Table, Table[Date] = calculate(max(Table[Date]), allexcept(Table, Table[Product ID], Table[Location]))))

 

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
alexei7
Continued Contributor
Continued Contributor

Thanks for your help - worked perfectly.

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.

Top Solution Authors
Top Kudoed Authors