web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

InventTrans logic to replicate Inventory Aging Report

(1) ShareShare
ReportReport
Posted on by 6
Hello D365 community,

After quite some research and ultimately trial and error, I was able to replicate our daily on hand quantities and costs from D365's Inventory Aging Report using just the InventTrans table with this logic:

CREATE VIEW [dbo].[fact_inventory_transactions] AS
SELECT 
    t1.qty - t1.qtysettled AS qty,
    CASE 
        WHEN t1.statusissue = 1 OR t1.statusreceipt = 1
            THEN t1.costamountposted + t1.costamountadjustment
        WHEN t1.statusissue = 2 OR t1.statusreceipt = 2 
            THEN t1.costamountphysical
        ELSE NULL
    END AS cost,

FROM inventtrans t1
WHERE 
    t1.statusissue IN (1, 2) OR t1.statusreceipt IN (1, 2);
 
For context, I'm not in finance -- I'm a data engineer working with Fabric SQL off linked D365 base tables.

I think I understand the logic behind on hand cost, but what is the logic behind on hand quantity? Why qty - qtysettled?
 
It feels wrong, but the numbers seem to match up to the inventory value aging report (as with cost).

Thank you!

Jamie
Categories:
I have the same question (0)
  • Suggested answer
    CA Neeraj Kumar Profile Picture
    292 on at
    InventTrans logic to replicate Inventory Aging Report
    Hi Jamie,

    While it's theoretically possible to calculate inventory value using custom logic with InventTrans and InventSettlement, I’m personally not a strong advocate for reinventing this process. Inventory valuation in D365 is significantly more complex than it appears on the surface, especially when accounting for settlements, backdated transactions, and cost adjustments.

    Instead, I recommend using the Inventory Value Report Storage process, which provides a reliable and system-validated way to capture inventory quantities and values.

    Once the Inventory Value Report Storage is run, the results are stored within D365 and can be accessed via a standard data entity:

     

    🔹 Entity Name: InventInventoryValueReportStorageV2Entity

    This entity can be used to expose the data externally (e.g., to Power BI, Azure Data Lake, or other integrated systems).

    I've personally used this approach to build an automated Inventory vs. General Ledger (GL) reconciliation via Electronic Reporting, and I can confirm that it performs accurately and consistently.

    If you'd like further guidance on setting this up, I'd be happy to assist.

     
    Regards,
    Neeraj Kumar
      
    If this helped, please mark it as "Verified" for others facing the same issue Keep in mind that it is possible to mark more than one answer as verified
     
  • JL-25081951-0 Profile Picture
    6 on at
    InventTrans logic to replicate Inventory Aging Report
    @CA Neeraj Kumar
    🤯
    First of all thank you!! Countless hours of research (and trying to ask AI), but you finally explained how this really works...!

    I only have one follow-up question for you -- Based on what you're saying then, could I theoretically produce an exact inventory qty and cost on hand for any historical date using a combination of inventtrans and inventsettlement? In other words, match the inventory aging report for the same target date?
  • André Arnaud de Calavon Profile Picture
    297,369 Super User 2025 Season 2 on at
    InventTrans logic to replicate Inventory Aging Report
    PS. Moved the question from the Dynamics 365 General to the Dynamics 365 Finance forum
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    297,369 Super User 2025 Season 2 on at
    InventTrans logic to replicate Inventory Aging Report
    Hi Jamie,

    I think you should be able to use the QTY only. That is the quantity used for each inventory action. Is this the whole query, or do you also have voucher or date fields included? If you need to backdate a report, then there are some caveats to be aware of. E.g. the physical date can be after the financial date. In that case the total will sum correctly, but on a specific date, you might have a difference. 

    Also note that many on-hand related reports in the standard are taking the date from the InventSum table which is the actual situation. When backdating a report, the inventory transactions form report date until today are subtracted from the numbers on the InventSum table.
  • Verified answer
    CA Neeraj Kumar Profile Picture
    292 on at
    InventTrans logic to replicate Inventory Aging Report
     
    Hi Jamie,
     
    In settlement-based inventory valuation methods like FIFO, Weighted Average, etc., the system performs inventory closing/recalculation to settle issue transactions against receipt transactions.
    • The Quantity settled field in the InventTrans table shows how much of a receipt or issue has been matched (or "settled") during this process.
    • In theory, for each settled receipt, there’s a corresponding settled issue — meaning the net settled quantity becomes zero across the system.
     
    But why do we subtract QtySettled from Qty?
    Because we want to calculate what's still available in inventory — i.e., what's not yet consumed or sold. 
     
    That’s why we use: Qty - QtySettled
    This gives us the unsettled quantity, which reflects the remaining (on-hand) quantity for that transaction line. 
     
    Example
    Let's say you receive 100 units of an item into inventory.
    TransType Qty QtySettled Remaining (Qty - QtySettled)
    Receipt 100 60 40
    Then you issue (sell) 60 units.
    TransType Qty QtySettled Remaining (Qty - QtySettled)
    Issue -60 -60 0
    • The 60 issued units are settled against 60 of the 100 received units.
    • The remaining 40 units from the receipt are still on hand.
    • That’s why we use Qty - QtySettled = 40 to determine on-hand.
     
     Important Note
    • The value (cost) of the settled quantity is also fully matched during inventory close.
    • So, if you're looking at total inventory value over time, the impact of settled quantity is neutral.
    • But if you're generating reports for a specific point in time or aging, then it’s essential to filter for unsettled quantities only, so the value and quantity align correctly.
     
    Closing Thought
    This explanation is based on my practical experience working with inventory costing and valuation in D365. Other experts may have additional insights or edge cases to consider, especially across different costing methods and industry-specific setups.
     
    Thanks and regards,
    Neeraj Kumar
     
    If this helped, please mark it as "Verified" for others facing the same issue Keep in mind that it is possible to mark more than one answer as verified

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 775 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 634 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 622 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans