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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
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.