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
Matej
Helper I
Helper I

Value returned based on specific time requirement

Hello all, 

I'm trying to figure out an issues in my report. 

 

I have a list of items with cost that is being changed at random intervals (my current dataset includes data from 1/1/22 - 31/1/23). I have managed to write some measured to get first and last cost based on filter context: 

 

_lastOldIDC =
VAR tbl = VALUES('IDCs')
VAR max_date = MAXX('IDCs', [Maximum of Date])
VAR result =  MINX(FILTER(tbl, [Maximum of Date] = max_date), [Old Value])
RETURN
    result
 
_firstOldIDC =
VAR tbl = VALUES('IDCs')
VAR min_date = MINX('IDCs', [Maximum of Date])
VAR result =  MINX(FILTER(tbl, [Maximum of Date] = min_date), [Old Value])
RETURN
    result
 
snip.png
 
These two work great but now I need a similiar measure that will only return a value (cost change) that represents the last value in the column before 10/11/2022. In the example based on the screenshot the value returned would be £2.43 as a last value in the column before the treshold (10/11/22). My measures can filter out other values and dates if I use a slicer but that only captures defined space of time and not the last cost change done prior to 10/11/2022. 
Any help here would be massively appreaciated. 
1 ACCEPTED SOLUTION
sebastiandyrby
Resolver I
Resolver I

Hi

This could be done like this - is that what you're looking for?

sebastiandyrby_0-1675946385713.png

This returns the following with my dataset-copy:

sebastiandyrby_1-1675946424489.png

 

Best regards

View solution in original post

2 REPLIES 2
sebastiandyrby
Resolver I
Resolver I

Hi

This could be done like this - is that what you're looking for?

sebastiandyrby_0-1675946385713.png

This returns the following with my dataset-copy:

sebastiandyrby_1-1675946424489.png

 

Best regards

This is literally what I've been looking for. Many thanks for the help!

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