Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Increase amount on every row

Maybe there is a easy way to add this measure. I've been trying to increase the amount on every row from 2020 onwards (every amount will be added to the previous result). I've been trying different measures but cannot get the right results. 

 

The result I've been looking for would be something like this table:

 

Date- Amount- Calc amount
01-01-2019- 10001000
02-01-2019- 20002000
01-01-2020- 10001000
02-01-2020- 20003000
03-02-2020- 20005000

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    Based on your description, you can create a measure as follows.

    calculated_measure =

    var x1=CALCULATE(

        SUM('Table1'[- Amount]),

        FILTER(ALL('Table1'),'Table1'[Date].[Year]=2020&&'Table1'[Date]<=MAX('Table1'[Date])))

    return

    IF(MAXX('Table1','Table1'[Date].[Year])=2020,x1,MAX('Table1'[- Amount]))


    Result:

     

    Hope that's what you were looking for.

    Best Regards,

    Yuna

     

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

3 Replies

  • Hi Anonymous ,

     

    You can add a column in Power Query with this code:

    if Date.Year([Date]) >= 2020 then [Amount] + 1000 else [Amount]

     

    Pete 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Based on your description, you can create a measure as follows.

    calculated_measure =

    var x1=CALCULATE(

        SUM('Table1'[- Amount]),

        FILTER(ALL('Table1'),'Table1'[Date].[Year]=2020&&'Table1'[Date]<=MAX('Table1'[Date])))

    return

    IF(MAXX('Table1','Table1'[Date].[Year])=2020,x1,MAX('Table1'[- Amount]))


    Result:

     

    Hope that's what you were looking for.

    Best Regards,

    Yuna

     

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks for the help, this measure helped