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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Jayesh
Regular Visitor

DAX to subtract the previous value with another column value

Hi there,

Need help with DAX for achieving the Actuals below (considering planned and execution data is present):

 

1.png

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Jayesh ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) Click "transform data" to enter the power query and add a index column.

vtangjiemsft_1-1704090048069.png

(3) We can create a calculated column.

 

Actual = 
var _a=CALCULATE(SUM('Table'[Planned]),FILTER('Table','Table'[Index]=1)) 
var _b=CALCULATE(SUM('Table'[Execution]),FILTER('Table','Table'[Index]<EARLIER('Table'[Index])+1))
return _a-_b

 

(4) Then the result is as follows.

vtangjiemsft_0-1704089986502.png

Best Regards,

Neeko Tang

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Jayesh ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2) Click "transform data" to enter the power query and add a index column.

vtangjiemsft_1-1704090048069.png

(3) We can create a calculated column.

 

Actual = 
var _a=CALCULATE(SUM('Table'[Planned]),FILTER('Table','Table'[Index]=1)) 
var _b=CALCULATE(SUM('Table'[Execution]),FILTER('Table','Table'[Index]<EARLIER('Table'[Index])+1))
return _a-_b

 

(4) Then the result is as follows.

vtangjiemsft_0-1704089986502.png

Best Regards,

Neeko Tang

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

Thanks it helps

Ritaf1983
Super User
Super User

Hi @Jayesh 

Please refer to my answer in the linked discussion (it also includes PBIX to follow):

https://community.fabric.microsoft.com/t5/Desktop/difference-from-previous-row-in-a-measure/m-p/3287...

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Thanks for sharing the solution, but my specific requirement is a bit different,

First Value of actual column is a straight subraction from execution then after i am subtracting the previous value of actual with execution 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.