Forum Discussion

Tonocop2390's avatar
Tonocop2390
New Member
1 year ago
Solved

How to create a column that completes itself based on values from the column itself?

For example I have a table that has actuals from January to April, and then for the rest of the year, I have to calculate based on the previous value. Let's say April has 1000, so for May my calcula...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Tonocop2390 ,

    Please try the code below.

     

    Column2 = 
    Var _Month=
    CALCULATE(
        MAX('Table'[Month]),
        FILTER('Table',[Value]<>BLANK())
        )
    Var _Sum=
    CALCULATE(
        SUM('Table'[Column]),
        FILTER('Table',[Month]<=EARLIER('Table'[Month])&&[Month]>=_Month)
        )
    RETURN
    IF([Value]<>BLANK(),[Value],_Sum)

     

     

    Best regards,

    Lucy Chen

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