Forum Discussion
MASF
3 years agoFrequent Visitor
Most recent MAX value
Hello Anybody knows how to create a DAX measure to get the LATEST (most recent) MAX value? For example, in the set of dates bellow, the most recent max value is 115 and it happened on the 2022-1...
- 3 years ago
hi MASF
Now i see, try to write a measure like this:
LastestPeak = VAR _table = FILTER( TableName, VAR _val = [val] VAR _date = [date] VAR _valpre = MINX( FILTER( TableName, _date -1 = [date] ), [val] ) RETURN IF(_val>_valpre, TRUE, FALSE) ) VAR _datemax = MAXX(_table, TableName[date]) RETURN MAXX( FILTER( _table, TableName[date]=_datemax ), TableName[val] )
DimaMD
Solution Sage
3 years agoHi MASF If I understood your task correctly, then try such an event.
If you are using a date table then you will need to replace the Min and Max measures from the date table
latest =
VAR _1 = CALCULATE( SUM('table'[val]), 'table'[date] = MIN('table'[date]))
VAR _2 = CALCULATE( SUM('table'[val]), 'table'[date] = MAX('table'[date]))
Return
IF( _1 >= _2, _1)