Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Casperserven1
Helper I
Helper I

Accumulating using previous

I am trying to fo tthe following and struggling - I am sure this is easy but just can't see it.

New HiresRetireesTotal Workforce
3520
6323
8130
9831
4629
3131
2132
7831

So in excel my first row = 22 +New Hires - Retirees

My second row = 20 (the result from the previous row) +NewHires - Retirees
My third row    = 23  (the result from the previous row) +NewHires - Retirees
etc.. 
Tried various things including EARLIER, using indexing, 

1 ACCEPTED SOLUTION
Kishore_KVN
Solution Sage
Solution Sage

Hello @Casperserven1 , 

We can achieve this using multiple ways but I can recall and create using one way among them. 

You may need to create four columns for this. 

First two columns are index columns from '0' and '1' which can be created in Power Query Editor.

For next two columns the DAX calculations looks as below:

Reference = IF('Data Table'[Index] = 0, 'Data Table'[Total Workforce],LOOKUPVALUE('Data Table'[Total Workforce],'Data Table'[Index New],'Data Table'[Index]))
Result = IF('Data Table'[Index]=0,'Data Table'[Reference],'Data Table'[Reference]+'Data Table'[New Hires]-'Data Table'[Retirees])

 

Output looks like this:

Kishore_KVN_0-1686762242228.png

 

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

 

View solution in original post

3 REPLIES 3
Casperserven1
Helper I
Helper I

Many thanks - yes that works, however I wanted this to be a measure so that I can apply row context to it - any ideas using measures??

Casperserven1
Helper I
Helper I

Many thanks - yes that works, however I wanted this to be a measure so that I can apply row context to it - any ideas using measures??

Kishore_KVN
Solution Sage
Solution Sage

Hello @Casperserven1 , 

We can achieve this using multiple ways but I can recall and create using one way among them. 

You may need to create four columns for this. 

First two columns are index columns from '0' and '1' which can be created in Power Query Editor.

For next two columns the DAX calculations looks as below:

Reference = IF('Data Table'[Index] = 0, 'Data Table'[Total Workforce],LOOKUPVALUE('Data Table'[Total Workforce],'Data Table'[Index New],'Data Table'[Index]))
Result = IF('Data Table'[Index]=0,'Data Table'[Reference],'Data Table'[Reference]+'Data Table'[New Hires]-'Data Table'[Retirees])

 

Output looks like this:

Kishore_KVN_0-1686762242228.png

 

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

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors