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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Stock On Hand

Hello , im trying to archieve the following measure :

 

i need to calculate the actual stock in every month  , starting from a inicial stock adding the customers buy and substracting the customer sales : 

 i have the folowing tables :

 

sell in : are the products wich each reseller buy to my company  

sell out : are the sales from each reseller to final customer

inicial stock : the inicial stock in every product in every customer 

 

I can also attach a pbix with this example 

 

what i need to do is :

   date       customer        sku          Sell in      Sell Out                          Stock  

2020-02 | Customer1 | PROD001 |      0      |     273      | (previous month stock +sell in - sell out) 

 

 

 

inv test.png

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , You have use Intial stock + Cumalative Sell in - Cumalative Sell out

 

Qunatity on hand = [Intial stock] + CALCULATE([Sell in],filter(allselected(Date),Date[Date] <=max(Date[Date]))) -CALCULATE([Sell out],filter(allselected(Date),Date[Date] <=max(Date[Date])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hello , amit , can you check te answer i posted using your solution ??

Anonymous
Not applicable

This was Great!! very helpfull , just for  one detail : 

 

If in the moth i have no sell in , the cumulative sum repeats the last acumulated  value instead of sum 0

 

I created the tu cumulative measures , as you can see in the picture :

inv test.png

 

 

thanks @amitchandak 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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