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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
msbiuser1
Advocate I
Advocate I

Dax to crack scenario - previous row and apply results in same row

Hi All,

We have a scenario where we need to loop the calculation in same column. Following is the sample data:

ABC 
123 
562Result
938Result
136Result
455Result

The column C will have only first row filled and here its 3.

The below rows for column C is as follows:

Value of Previour row in Column C +Current row of Column A - Current row of Column B

ie to get 2nd row = 3+5-6 = 2

    to get 3rd row = 2+9-3 = 8

    to get 4th row =8+1 -3 =6

    to get 5th row = 6+4-5 = 5

Kindly advice me to crack this.
Thanks in advance.

1 ACCEPTED SOLUTION

Hi its tricky and here are the results:

We have to split into 3 measures:

m1 : get that 3 in all rows in a column

m2: get a column with column A minus B where sheet C has blank

m3: now add m1 +m2 You get the results as desired.

m1 m2  m3

3           3

3    -1    2

3    5     8

3    3     6

 

View solution in original post

6 REPLIES 6
RichardOfSydney
Regular Visitor

lookupvalue use index-1 to get pervious row

 

It doesnt work brother. If works update the dax. Let us know

Hi its tricky and here are the results:

We have to split into 3 measures:

m1 : get that 3 in all rows in a column

m2: get a column with column A minus B where sheet C has blank

m3: now add m1 +m2 You get the results as desired.

m1 m2  m3

3           3

3    -1    2

3    5     8

3    3     6

 

 

Really appreciate if you can guide us with measure

RichardOfSydney
Regular Visitor

you will need an index column , use that to find the previous row.

I did that. Was able to bring 3 in second row. But how to handle for remaining rows.There we get blanks

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.