Forum Discussion

shkabuzar's avatar
shkabuzar
Frequent Visitor
5 years ago
Solved

Calculate future month values using the previous month value

Hi,  My data looks as below and future values to be calculated using previous month values. Table1 year_month Value 01-10-2020 10 01-11-2020 15 01-12-2020 22 01-01-2021 34 ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi shkabuzar ,

     

    Please try the following formula to create a measure:

    Measure = 
    VAR _date =
        CALCULATE (
            MAX ( 'Table1'[year_month] ),
            FILTER ( 'Table1', 'Table1'[year_month] <= MAX ( 'Calendar table'[Date] ) )
        )
    VAR _value =
        CALCULATE ( MAX ( 'Table1'[Value] ), 'Table1'[year_month] = _date )
    VAR _monthdiff =
        DATEDIFF ( _date, MAX ( 'Calendar table'[Date] ), MONTH )
    RETURN
        IF ( _monthdiff = 0, _value, _value * POWER ( 1.1, _monthdiff ) )
    

    Here is the final output:

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.