Forum Discussion
Matej
3 years agoHelper 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
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.
Hi
This could be done like this - is that what you're looking for?
This returns the following with my dataset-copy:
Best regards
2 Replies
- sebastiandyrbyResolver I
Hi
This could be done like this - is that what you're looking for?
This returns the following with my dataset-copy:
Best regards
- MatejHelper I
This is literally what I've been looking for. Many thanks for the help!