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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Reddyp
Helper I
Helper I

Inventory aging calculation_DAX

I need to do this inventory calculation for individual branch (Example: if stock sold in branch 1 then the count of sold should deduct from Branch 1)

Example: I have received stock to B ranch 1 on 1st, 2nd, and 3rd and the stock is 10 shirts per day and total stock is 30 now 
and on 4th 15 shirts sold 

desired result: the sold count in Branch 1 should deduct fromn first in date in branch 1(the count sold is 15 on 4th so 10 should be decuted from 1st date and 5 shoud be deducted on 2nd)
and in the same way when 7 shirts sold on 5th date then 5 deducted from 2nd date (remaining in 2nd date) and 2 should deduct from 3rd date

Note: Calculation should be done based on Branch

Can you please helpme with the DAX code
I have already received response from @Greg_Deckler for my previous question in calculating stock in and stock out for one branch (https://community.powerbi.com/t5/Desktop/Inventory-stock/td-p/2431824)
Request: But now I have different branches in my data and I need help in modifing DAX code. 
Example: 

Date

Branch

New Stock

Stock out

Result

01-01-2022

Branch 1

10

 

0

02-01-2022

Branch 1

10

 

0

03-01-2022

Branch 1

10

 

8

04-01-2022

Branch 1

 

15

 

05-01-2022

Branch 1

 

7

 

06-01-2022

Branch 2

10

 

0

07-01-2022

Branch 2

10

 

5

08-01-2022

Branch 2

10

 

10

09-01-2022

Branch 2

 

15

 

10-01-2022

Branch 3

10

 

0

11-01-2022

Branch 3

 

10

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User
1 REPLY 1
tamerj1
Super User
Super User

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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