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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Yashh
Helper II
Helper II

Incemental Subtraction

Hello All,

 

Currently I am having this view in Power BI

Sales documentMaterialOrdered QuantityStock.Available QuantityRemaining Stock
2744570105980561533115275
2793574105980561533115275
2744571105980561533115275
2793575105980561533115275

 

But I want to have  this view

Sales documentMaterialOrdered QuantityStock.Available QuantityRemaining Stock
2744570105980561533115275
2793574105980561527515219
2744571105980561521915163
2793575105980561516315107

 

How can I do it and also i have many materials so for every material I have to do it. 

 

I will give an example of the  different materials i have

 

Sales documentMaterialOrdered QuantityStock.Available Quantity
27445701059805615331
27935741059805615331
27445711059805615331
27935751059805615331
2787998105644613
2792122105644613
2793918105644613
278685952222724548
278686052222724548
278686152222724548
278458672632614109
27932115551531186
27968895551531186
27968715551531186
27964925551531186
27965805551531186
27969185551531186
27968905551531

186  

 

Please help me with this.

 

BR 

Yashh Gaikwad

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Yashh 

pls try to create an index column and  create two calculated columns

stock available = 
VAR _index = CALCULATE(min([Index]),ALLEXCEPT('Table','Table'[Material]))
return [Stock.Available Quantity]-sumx(FILTER('Table','Table'[Material]=EARLIER('Table'[Material])&&[Index]<=EARLIER('Table'[Index])&&'Table'[Index]>_index),'Table'[Ordered Quantity])



remaining stock = [Stock.Available Quantity]-sumx(FILTER('Table','Table'[Material]=EARLIER('Table'[Material])&&[Index]<=EARLIER('Table'[Index])),'Table'[Ordered Quantity])

 1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
ryan_mayu
Super User
Super User

@Yashh 

pls try to create an index column and  create two calculated columns

stock available = 
VAR _index = CALCULATE(min([Index]),ALLEXCEPT('Table','Table'[Material]))
return [Stock.Available Quantity]-sumx(FILTER('Table','Table'[Material]=EARLIER('Table'[Material])&&[Index]<=EARLIER('Table'[Index])&&'Table'[Index]>_index),'Table'[Ordered Quantity])



remaining stock = [Stock.Available Quantity]-sumx(FILTER('Table','Table'[Material]=EARLIER('Table'[Material])&&[Index]<=EARLIER('Table'[Index])),'Table'[Ordered Quantity])

 1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.