cancel
Showing results for
Did you mean:
Anonymous
Not applicable

## How to add previous row value with current one and then keep getting the summation

HI below is the table as input in power bi and below that is the output i would require in power bi. Please let me know how is it possible in calculated column or Measure. its basically addition of previous row with current row please see the example below:

Input:

Date                       Value
22march 2017             3

23march 2017             3

24march 2017             2

25march 2017             11

01 January 2018           5

Output:

Date                       Value      Final Value
22march 2017             3               3

23march 2017             3               6

24march 2017             2               8

25march 2017             11            19

01 January 2018           5             24

I would require the Final value to be calculated. Please let me know the steps or formulae required.

thanks,
Ankku

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

## Re: How to add previous row value with current one and then keep getting the summation

Hi @Anonymous,

You can create a calculated column:

Column = CALCULATE(SUM('Table3'[Value]),FILTER('Table3','Table3'[Date]<=EARLIER('Table3'[Date])))

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 REPLIES 5
Moderator

## Re: How to add previous row value with current one and then keep getting the summation

Hi @Anonymous,

You can create a calculated column:

Column = CALCULATE(SUM('Table3'[Value]),FILTER('Table3','Table3'[Date]<=EARLIER('Table3'[Date])))

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Frequent Visitor

## Re: How to add previous row value with current one and then keep getting the summation

@v-qiuyu-msft thanks for the solution, it was exactly what I was looking for. I just have another question. Is it possible to perform the same calculation using a measure? If not, not a problem.

Moderator

## Re: How to add previous row value with current one and then keep getting the summation

Of course. You can create a measure below:

Measure=CALCULATE(SUM('Table3'[Value]),FILTER(all('Table3'),'Table3'[Date]<=Max('Table3'[Date])))

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Visitor

## Re: How to add previous row value with current one and then keep getting the summation

your formulas really helped me a lot. Now I have the question if the same calculation can be made in Power Query (Custom column)?

Link to image . Cuz I want to use my calculated columns in Data pane (Link to image ) as an import into new Power Queries.

Thanks a lot in advance.

Best regards

Saso

Regular Visitor

## Re: How to add previous row value with current one and then keep getting the summation

Hi,

Is it possible to do this for each week? I mean summing the values per week.

Thanks.

Announcements

#### Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

#### Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

#### January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors
Top Kudoed Authors