Forum Discussion

DataAnalyst_99's avatar
4 years ago
Solved

Please help!

I have to calculate the previous day's values from my table, for which I have created a measure and it is working fine  previousdates = var _PrevDate = calculate( MAX(data[Created Date]), ALL...
  • PaulOlding's avatar
    PaulOlding
    4 years ago

    Try using REMOVEFILTERS to explicitly remove the filters on Year and Month

    var _PrevDate =
    calculate(
        MAX(data[Created Date]),
        data[Created Date] < SELECTEDVALUE(data[Created Date]),
        REMOVEFILTERS(<Year Column>),
        REMOVEFILTERS(<Month Column>)
    )

    You'll probably need the REMOVEFILTERS on the _Index calculation too.

     

    Best practice here would still be to use a date table.  You could use LASTNONBLANKVALUE to go back to the previous date that exists in the data.