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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

InventTrans logic to replicate Inventory Aging Report

(6) ShareShare
ReportReport
Posted on by 28
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)
  • Verified answer
    CA Neeraj Kumar Profile Picture
    5,108 Super User 2026 Season 1 on at
     
    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
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    304,253 Super User 2026 Season 1 on at
    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.
  • André Arnaud de Calavon Profile Picture
    304,253 Super User 2026 Season 1 on at
    PS. Moved the question from the Dynamics 365 General to the Dynamics 365 Finance forum
  • JL-25081951-0 Profile Picture
    28 on at
    @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?
  • Suggested answer
    CA Neeraj Kumar Profile Picture
    5,108 Super User 2026 Season 1 on at
    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
    28 on at
    @CA Neeraj Kumar

    Thanks again for your response.

    I don't readily have access to D365 itself, but I do have full access to all raw tables. Also I need to automate a process of recording a daily snapshot of inventory levels per item x day x store for multiple years.

    Let's say I don't necessarily need cost/financial values, but I would like to get an accurate physical on hand qty amount for each historical day. Can I achieve this by forward summing InventTrans alone?

    I tried forward summing Qty from InventTrans for a few test store x items but I could not get it to match on their respective PhysicalInvent qty records in InventSum.
  • Suggested answer
    CA Neeraj Kumar Profile Picture
    5,108 Super User 2026 Season 1 on at
    Hi Jamie,
     
    As mentioned by @André Arnaud de Calavon as well if you want to backdate a report (historical date) then there are some caveats to be aware as mentioned below:
     
    and if you want just the snapshot at particular datetime for the on-hand inventory, then summing up the Inventtrans (with correct filters), or using the inventsum will work for you. Assuming there will be some batch job which will keep the snapshot for inventory on-hand on daily basis.
     
    You can also share the query that you have prepared to get the on-hand and it is not matching.. 
     
    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
    28 on at
    @André Arnaud de Calavon

    After some filtering I was indeed able to replicate qty on hand today by forward summing qty in inventtrans alone. I will also consider the route backwards deducting from inventsum...

    @CA Neeraj Kumar

    Gentlemen I want to thank you both kindly for the assistance! Cheers!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 657

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 453 Super User 2026 Season 1

#3
Martin Dráb Profile Picture

Martin Dráb 190 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans