Generating a Historical Inventory Report

Last updated: January 12, 2026

This article describes how to generate a report for the stock that you had managed via Cofactr as of a specific historical date. This is useful for accounting audits and other similar purposes.

Navigate to: https://platform.cofactr.com/reporting/sql

Note: The SQL Explorer feature is not included with all Cofactr plans. Please contact success@cofactr.com to discuss upgrades to a plan that includes SQL Explorer if you do not already have access.

Copy and paste the following query into the query field:

SELECT
    mpn,
  mfg,
  description,
  unit_price,
    SUM(quantity) as total_quantity
FROM (
    SELECT DISTINCT ON (stock_lot_history.id)
        stock_lot_history.quantity,
        stock_lot_history.history_timestamp,
        part.mpn,
  part.mfg,
  part.description,
  stock_lot.id,
  stock_lot.unit_price
    FROM stock_lot_history
    LEFT JOIN stock_lot ON stock_lot_history.id::uuid = stock_lot.id
    LEFT JOIN part ON stock_lot.part_id = part.id
    WHERE stock_lot_history.history_timestamp <= '2024-11-30 23:59:59' AND mpn IS NOT NULL
    ORDER BY stock_lot_history.id, stock_lot_history.history_timestamp DESC
) latest_records
GROUP BY mpn, mfg, description, unit_price

Replace 2024-11-30 with the date that you would like to run the report for.

Click Run Query

If you have a large library of parts, it may take a minute or two for the data to load.

Optionally, click Export to save the report as a CSV or Excel File