Forum Discussion

rajasekaro's avatar
rajasekaro
Helper III
10 months ago
Solved

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.  i tryd but not comming corre...
  • grazitti_sapna's avatar
    10 months ago

    Hi rajasekaro,

     

    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)

     

    🌟 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.
    💡 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!