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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors