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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
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])

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])

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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