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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.