Forum Discussion

nthomson's avatar
nthomson
Frequent Visitor
6 years ago
Solved

Value associated with second most recent date

Hi,   I'm trying to filter the values in a table by the second most recent date. So, from the table below the formula would output '4', because it is associated with 4-Jan.   I am trying to use f...
  • lbendlin's avatar
    lbendlin
    6 years ago

    I just tried the measure on your test data and it works as expected. What error are you getting exactly?

     

    2nd Recent Value = 
    var thisdate= max('DATA SHEET ACTUALS'[Date])
    var seconddate = CALCULATE(max('DATA SHEET ACTUALS'[Date]),'DATA SHEET ACTUALS'[Date]<thisdate)
    return CALCULATE(SUM('DATA SHEET ACTUALS'[Value]),'DATA SHEET ACTUALS'[Date] = seconddate)