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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
RAJASEKAR-O
New Member

How to Calculate Stock Aging Using FIFO Method

hi Team,
I’m working on a stock/ inventory aging report in Power BI and need to apply the
FIFO (First-In-First-Out) logic to calculate the age of the remaining stock
but it showing stock movement 
How to Calculate Stock Aging Using FIFO Method
table  : F_Inventory

ItemDOCIDIN_DOCDATEqtyTRTY
Surgical Mask45014930-01-2024400RCPT
Surgical Mask45016910-03-2024400RCPT
Surgical Mask45019508-08-2024250RCPT
Surgical Mask45023907-06-2024100RCPT
Surgical Mask45030823-07-2025100ISSU
Surgical Mask45031008-09-2024250ISSU
Surgical Mask45031401-01-2025250RCPT
Surgical Mask45033131-05-2024100RCPT
Surgical Mask45040230-01-2024200RCPT
Surgical Mask45041525-04-2024200RCPT
Surgical Mask45042001-03-2024150RCPT
Surgical Mask45044305-05-2025100RCPT
Surgical Mask45055130-01-2025300RCPT
Surgical Mask45058422-02-2024150RCPT
Surgical Mask45058904-02-2024100RCPT
Surgical Mask45059301-02-2024400RCPT
Surgical Mask45060525-04-2024300RCPT
Surgical Mask45062928-01-2024100RCPT
Surgical Mask45063503-07-2024150RCPT
Surgical Mask45089712-04-2024300RCPT
Surgical Mask45092721-05-2024300ISSU
Surgical Mask45094706-05-2025150RCPT
Surgical Mask45096504-04-2024300RCPT
Surgical Mask45097505-03-2024150ISSU
Surgical Mask45099506-06-2025250RCPT

 

RAJASEKARO_0-1760692988127.png

 

1 ACCEPTED SOLUTION
grazitti_sapna
Super User
Super User

Hi @RAJASEKAR-O,

 

Create a measure for running balance for receipts

 

CumulativeReceipts =
CALCULATE(
SUM(F_Inventory[qty]),
FILTER(
F_Inventory,
F_Inventory[Item] = EARLIER(F_Inventory[Item]) &&
F_Inventory[TRTY] = "RCPT" &&
F_Inventory[IN_DOCDATE] <= EARLIER(F_Inventory[IN_DOCDATE])
)
)

 

Dax for running balance for issues

CumulativeIssues =
CALCULATE(
SUM(F_Inventory[qty]),
FILTER(
F_Inventory,
F_Inventory[Item] = EARLIER(F_Inventory[Item]) &&
F_Inventory[TRTY] = "ISSU" &&
F_Inventory[IN_DOCDATE] <= EARLIER(F_Inventory[IN_DOCDATE])
)
)

 

DAX for Remaining stock per receipt

 

RemainingQty =
VAR Receipts = F_Inventory[qty]
VAR Used = CALCULATE(
SUM(F_Inventory[qty]),
FILTER(
F_Inventory,
F_Inventory[Item] = EARLIER(F_Inventory[Item]) &&
F_Inventory[TRTY] = "ISSU" &&
F_Inventory[IN_DOCDATE] >= EARLIER(F_Inventory[IN_DOCDATE])
)
)
RETURN MAX(0, Receipts - Used)

 

grazitti_sapna_0-1760700465466.png

 

 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.

grazitti_sapna_1-1760700465468.png

 

 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.

 

 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.

 

 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

View solution in original post

4 REPLIES 4
grazitti_sapna
Super User
Super User

Hi @RAJASEKAR-O,

 

Create a measure for running balance for receipts

 

CumulativeReceipts =
CALCULATE(
SUM(F_Inventory[qty]),
FILTER(
F_Inventory,
F_Inventory[Item] = EARLIER(F_Inventory[Item]) &&
F_Inventory[TRTY] = "RCPT" &&
F_Inventory[IN_DOCDATE] <= EARLIER(F_Inventory[IN_DOCDATE])
)
)

 

Dax for running balance for issues

CumulativeIssues =
CALCULATE(
SUM(F_Inventory[qty]),
FILTER(
F_Inventory,
F_Inventory[Item] = EARLIER(F_Inventory[Item]) &&
F_Inventory[TRTY] = "ISSU" &&
F_Inventory[IN_DOCDATE] <= EARLIER(F_Inventory[IN_DOCDATE])
)
)

 

DAX for Remaining stock per receipt

 

RemainingQty =
VAR Receipts = F_Inventory[qty]
VAR Used = CALCULATE(
SUM(F_Inventory[qty]),
FILTER(
F_Inventory,
F_Inventory[Item] = EARLIER(F_Inventory[Item]) &&
F_Inventory[TRTY] = "ISSU" &&
F_Inventory[IN_DOCDATE] >= EARLIER(F_Inventory[IN_DOCDATE])
)
)
RETURN MAX(0, Receipts - Used)

 

grazitti_sapna_0-1760700465466.png

 

 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.

grazitti_sapna_1-1760700465468.png

 

 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.

 

 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.

 

 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!

Hi @RAJASEKAR-O ,

Thank you for reaching out to the Microsoft Community Forum.

 

Could you please try the proposed solution shared by @grazitti_sapna  ? Let us know if you’re still facing the same issue we’ll be happy to assist you further.

 

Regards,

Dinesh

Hi @RAJASEKAR-O ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Hi @RAJASEKAR-O ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.