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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
geemian93
Frequent Visitor

Calculation of age Days based on FIFO Inventory method

Dear Experts, @amitchandak  @Greg_Deckler 

I am looking for the help to calculate aging days based on the FIFO method of inventory from the two tables (Both tables have relationship based on Material No.),

 

First Table (Stock) include the closing stock of a particular item:

DateMaterial No.Quantity PC
30-Apr-23    10001    72,000.00

 

Second Table (PurchaseTable) contains the purchase history of this item:

Material No.Date of Purchase Quantity PC 
1000131-Mar-14       25,000.00
1000115-May-15       22,000.00
1000123-Sep-18       15,000.00
1000103-Oct-20       15,000.00
1000108-Jun-22       11,000.00
1000130-Sep-22         9,000.00
1000131-Mar-23         8,000.00
1000115-Apr-23       13,000.00

 

I wanted to apply the logic that only calculate age days from today date (11-May-23)
minus the last purchase quantity from the closing quantity (i.e. 72,000 - 13,000 pc) and so on untill the closing stock is completely consumed then leave the rest of the purchase histroy age days to zero.

 

Desired Results should be like this:

Material No.Date of Purchase Quantity PC Age in DaysStock Balance
1000131-Mar-14       25,000.00       0       (46,000.00)
1000115-May-15       22,000.00       0       (21,000.00)
1000123-Sep-18       15,000.00     1691           1,000.00
1000103-Oct-20       15,000.00     950         16,000.00
1000108-Jun-22       11,000.00     337         31,000.00
1000130-Sep-22         9,000.00     223         42,000.00
1000131-Mar-23         8,000.00      41         51,000.00
1000115-Apr-23       13,000.00      26         59,000.00
3 REPLIES 3
geemian93
Frequent Visitor

@Greg_Deckler Appreciate if you can look into this please.

Greg_Deckler
Community Champion
Community Champion

@geemian93 See if these help:

Delivery Dates - Microsoft Power BI Community

Order Fulfillment - Microsoft Power BI Community

 

If not, I'll try to take a closer look when I have some spare time.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  Thanks for your response.

 

I had a look into the proposed article, however it accumulates the item quantity with earliest possible delivery date.

The problem that I am facing is actually simpler since I just wanted to assign age (in days from current or specific date) deducting the most recent purchased quantity from the closing quantity of particular item until the closing quantity reaches "Zero" then leave rest of the purchase history line items age days to "0".

 

Apprecite if you can spare some time to look into this.

 

Regards

Waseem

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors