Reply
avatar user
Anonymous
Not applicable

Help with DAX code to subtract previous row

I need help to create DAX code to subtract previous row in SMU column. - refer table below.

 

For example 682-0=0, 895-682=213,910-895=15,950-910=40,1682-950=732. 

 

Any assistance would be greatly appreciated thank you. 

 

MarkPemberton12_0-1621554437923.png

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a new column like

 

Diff =[SMU] - maxx(filter(Table, [machine_no] =earlier([Machine_no]) && [SMU] < earlier([SMU])),[SMU])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Try a new column like

 

Diff =[SMU] - maxx(filter(Table, [machine_no] =earlier([Machine_no]) && [SMU] < earlier([SMU])),[SMU])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)