Forum Discussion

leeham's avatar
leeham
Frequent Visitor
3 years ago
Solved

Rate of change - DAX code

Hi,   I feel like I am missing something and wondered if anyone could see the mistake and know the solution? Date referenced in the code is a date (monthly) within a date table with a DD Month...
  • leeham's avatar
    3 years ago

    Solution:

    I was close with using parallelperiod.
    When i used lastdate with it, it pulled through the one month i needed and the rest worked.
    With it set to -1 it will pull the lastdate -1 month (as I specifcied month in the parallperiod).
    This solution gives the freedom to set any number of days/months/years.
    The solution will also allow for user input if you tweak the -1 to a variable that reads user input.

    New rate Delta = 
    var minus_1_dates = CALCULATE(LASTDATE(PARALLELPERIOD(Dates[Date],-1,MONTH)))
    return
    CALCULATE(Append1[new_rate],Dates[Date]=minus_1_dates)